I have a json and I want to get a value from a complex object. Here is my json:
{
"a1" : {
"a2" : {
"a3" : "desired_value"
}
}
}
And I want to obtain the value "desired value". I've tried to obtain it with this code:
var token = JToken.Parse(json);
string value = token.Value<string>("a1.a2.a3");
But the value
string is null. What should I put in the path so I can read this only once, I mean without getting a token and then iterate trough it's childern and so?