Baker1562 Baker1562 - 9 days ago 6
JSON Question

Show/Deserialize JSON in string

I have the next JSON

[[["Hello","Hola",,,1]],,"es"]


How can i get only the first object, in this case "Hello"?

Answer

Using JSON.NET, for example, you can do this:

var jsonObject = JsonConvert.DeserializeObject<JArray>("[[[\"Hello\",\"Hola\",,,1]],,\"es\"]");
string value = (string)((JValue)jsonObject[0][0][0]).Value;
Console.WriteLine(value);