I feel like this question must have been asked before, but maybe I don't know the terminology for what I'm describing here.
I'm stuck using a web service that returns JSON in which things you would normally expect to be arrays are instead children with names you cannot know ahead of time. For example, instead of this:
{
"orders": [
{ ... },
{ ... },
{ ... }
]
}
It gives me this:
{
"orders": {
"order-42": { ... },
"order-51": { ... },
"order-102": { ... }
}
}
I could parse the document as a JToken
and grab the children of "orders"
, but then I have the same problem again with the children of the order. For example, instead of the order property "lines"
being an array, it has children named "1"
, "2"
, etc.
To make matters worse, in some cases the names of the children contain information I need that seems like it should have been a property of the children.
What's the simplest way to deal with this?