[Solved] How to read this JSON string?


The clean way to handle JSON in C# is by using classes that represent the JSON structure and parse the JSON into them. For example, you can use json2csharp to generate these classes. Lets assume you have generated a class Test as parsing target:

using Newtonsoft.Json; 
private static readonly JsonSerializerSettings StrictJsonSettings = new JsonSerializerSettings {
    MissingMemberHandling = MissingMemberHandling.Error
};
Test test = JsonConvert.DeserializeObject<Test>(MyJsonString, StrictJsonSettings);
var jsonId = test[1].Id;

The hacky way is to cast the result as dynamic:

var parsedJson = JObject.Parse(MyJsonString) as dynamic;
var jsonId = parsedJson.Test[1].Id;

solved How to read this JSON string?