My JSON is as follows:
{"t":"1339886","a":true,"data":[],"Type":[['Ants','Biz','Tro']]}
I found the Newtonsoft JSON.NET deserialize library for C#. I tried to use it as follow:
object JsonDe = JsonConvert.DeserializeObject(Json);
How can I access to the JsonDe
object to get all the "Type" Data? I tried it with a loop but it is not working because the object does not have an enumerator.
You can implement a class that holds the fields you have in your JSON
class MyData { public string t; public bool a; public object[] data; public string[][] type; }
and then use the generic version of DeserializeObject:
MyData tmp = JsonConvert.DeserializeObject<MyData>(json); foreach (string typeStr in tmp.type[0]) { // Do something with typeStr }
Documentation: Serializing and Deserializing JSON
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With