I have a JSON string that looks similar to this:
{
"automatic" : "true",
"brainstorm" : "1000",
"zombies" : [{ "Name" : "Fred", "Grrh" : "50" }, { "Name" : "Sally", "Grrh" : "67" }, { "Name" : "Chris", "Grrh" : "23" }],
"nightSkyRadius" : "30"
... could be anything here or at the same level as zombies ...
}
So, in my scenario I know the Zombie objects in the array will always be the same. But I don't know anything else beyond that. That is to say, there could be any number of values at the same root as the zombies
value.
So my question is, how do I using Json.NET deserialize only my zombies
? I don't know what the other values are (if values is the right term) so I cannot just create an object that describes the incoming Json string. So I'm thinking I can just pick zombies
out of the json string and deserialize it then.
But, I thought, I'd have to write a string parser that would pull zombies
out.. that seems like an extra unnecessary step. Can't Json.NET
do this for me?
Also, I've tried JsonConvert.DeserializeObject<dynamic>(responseString);
but that can only handle the case when one zombie is specified in the response string.
Thanks, I hope zombies
made this problem seem cooler lol