I’m building a JSON file parser. I currently use the JavaScriptSerializer class to read the JSON file into a DynamicJsonObject that looks like
dynamic glossaryEntry
Then I can retrieve top level json nodes in the following manner. For retrieving this JSON group called Scoring that looks like
{
"Scoring":
[
{
"blah": "blah",
"blah": "blah"
},
{
"blah": "blah",
"blah": "blah"
}
]
}
I use the dynamic expression:
return glossaryEntry.Scoring;
Or for instance I’d use
return glossaryEntry.quests;
For a JSON that looked like:
{
"quests":
[
...
]
}
Which is very hardcoded and requires me to know in advance all possible identifiers that can be parsed. I am thinking there must be a way to have that dynamic expression evaluate to something so that the glossaryEntry.”this” part can be determined at runtime?
Thanks for any help you may be able to provide.
You can deserialize your json string to
Dictionary<string,object>