Retrieving data from an Object(deserialized json) in C# -
i have json string trying parse, using c#. have used jsonconvert serialize data json string.
here sample json string:
{"names": ["john", "joe", "jack"], "nationality": "american"}
i able deserialize string object using jsonconvert.deserializeobject(x);
the problem is, dont know how read object, using c#. can me out?
public class people { [jsonproperty("names")] public list<string> names; [jsonproperty("nationality")] public string nationality; }
other answers technically correct, using jsonpropertyattribute
universally accepted convention. use jsonconvert
:
var people = jsonconvert.deserializeobject<people>(x);
Comments
Post a Comment