I've been figuring out ways to use json.net and I have the following simple test case.
JObject jsonData = JObject.Parse("{\"nodes\": { \"left\": {\"att\": 1.0, \"ch\": 0}, \"right\": {\"att\": 1.0, \"ch\": 1}}}");
var nodes = jsonData ["nodes"].Children ();
foreach (JToken node in nodes) {
JToken speaker = node.First;
float attenuation = (float)speaker ["att"];
int channel = (int)speaker ["ch"];
string nodeName = /* HOW TO GET THE OBJECT NAME HERE ("left","right" in this example json) */
}
As I am iterating over the objects, I haven't been able to figure out how could I access the object name in this json (left/right in this example).
Is my parsing strategy totally off or am I missing something obvious?