I'm having trouble finding the correct method for getting a list of json arrays from JObject.
_name element inside the array should be equal to foo.
This is the sample json:
{
"doc": [{
"bob": [{
"tom": [{
"frank": [{
"category": [{
"_name": "foo",
"letters": "abc"
},
{
"_name": "foo",
"letters": "def"
},
{
"_name": "foo",
"letters": "ghi"
},
{
"_name": "foo",
"letters": "jkl"
}]
}]
}]
}]
}]
}
And here's my code so far:
JObject o = JObject.Parse(File.ReadAllText(@"D:/Client/data.json"));
var results = from x in o["doc"].Children()
where x["_name"].Value<string>() == "foo"
select x;
I get this error:
"Value cannot be null.\r\nParameter name: source"
How do I get a list in which each element will be an array containing "_name" and "letters"?
doc.bobbe an array containing an object with a propertytomwhich has a propertyfrank?