Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- JObject o = JObject.Parse("{'People':[{'Name':'Jeff'},{'Name':'Joe'}]}");
- // get name token of first person and convert to a string
- string name = (string)o.SelectToken("People[0].Name");
- JObject o = JObject.Parse("{'People':[{'Name':'Jeff','Roles':['Manager', 'Admin']}]}");
- // get role array token of first person and convert to a list of strings
- IList<string> names = (string)o.SelectToken("People[0].Roles").Select(t => (string)t).ToList();
Add Comment
Please, Sign In to add comment