I\'m developing an application that reads some JSON data and makes some statistics, but now I\'ve run into a problem.
I have a string like this:
{
\"posi
You can access the elements as follows:
var enumerable = (IEnumerable)values["position"]; // Will get you the enumerable ArrayList
(Dictionary<string,object>)values["position"][0]; // Will get you the First element of the ArrayList
(string)values["position"][0]["someKey1"]; // Will get you someKey1 from the first position of position
You can use Linq to JSON (add Newtonsoft's JSON.NET from NuGet):
JObject jo = JObject.Parse(json);
var value = (string)jo["position"][1]["someKey1"]; // someVal3
Another sample:
JObject jo = JObject.Parse(json);
JArray positions = (JArray)jo["position"];
foreach (var item in positions)
{
// use (string)item["someKey1"]
// use (string)item["someKey2"]
}