I come across some specially formatted JSON syntaxes from a web. Basically we get variable number of properties with dots in the name. Here are the two obvious cases:
case 1:
"data" {
"SET.Key.count":"0",
"SET.Value.count":"0",
...
}
case 2:
"data" {
"SET.Key.0":"Key 1",
"SET.Key.1":"Key 2",
"SET.Key.2":"Key 3",
"SET.Key.3":"Key 4",
"SET.Key.count":"4",
"SET.Value.0":"10",
"SET.Value.1":"20",
"SET.Value.2":"30",
"SET.Value.3":"40",
"SET.Value.count":"4",
...
}
Where count number 4 is an arbitrary number. They can be anything, but key count and value count should be same. "..." means more properties but they can be ignored for this post.
I deserialize JSON streams with Newtonsoft.Json and C#. But I don't have to stay with Newtonsoft.Json. How can I deserialize it into a list of objects (key and value). Any suggestions to handle this kind of JSON properties will be greatly appreciated.