Here is the list of data I receive, property names are can be different;
{"data":"[
{
"id":"1",
"name":"aa",
"email":"[email protected]",
"address":"11"
},
{
"id":"2",
"name":"bb",
"email":"[email protected]",
"address":"22"
}
]"}
Here is my c# code
Which I get an error on the 3rd line. Unable to read json data. Check the url you typed.Invalid cast from 'System.String' to 'Newtonsoft.Json.Linq.JObject'.
var jsonStr = wc.DownloadString(url);
JToken outer = JToken.Parse(jsonStr);
JObject inner = outer["data"].Value<JObject>();
List<string> keys = inner.Properties().Select(p => p.Name).ToList();
How can my output be like this;
id
name
emal
address
It would be great if I also consider n level array such as address > street and address > postcode
Many thanks.