c# - Parsin JSON with @ sign in key field -
i getting json follow:
"name": { "@value": "foo" }, "lastname": { "@value": "bar" }, "birth": { "@value": "198701010000" } when try parse this, unable values 'foo', 'bar' , bday.
rootobject deserializedproduct = jsonconvert.deserializeobject<rootobject>(obj); i m using code above parse it.
how can parse properly?
assuming have class rootobject looks this:
public class rootobject { public item name { get; set; } public item lastname { get; set; } public item birth { get; set; } } you can define item this:
public class item { [jsonproperty("@value")] public string value { get; set; } } and use jsonproperty attribute specify name of property you'd map item.value to.
Comments
Post a Comment