I am using JSONObject (http://wiki.unity3d.com/index.php?title=JSONObject) to parse a JSON file. I need to find out if the JSON is valid or not. I am using C#.
The JSON could look like this:
{
"_entries": [
"g0"
],
"_flow": {
"g1": {
"_expr": [
{
"word_": "player",
"_next": [
{
"word_": "gives",
"_next": [
{
"word_": "Shovel"
}
]
},
{
"word_": "to",
"_next": [
{
"word_": "Elisabeth"
}
]
}
]
}
],
"_interpr": {
"_subject": "player",
"_predicate": {
"_verb": "gives to",
"_direct": "Shovel",
"_indirect": "Elisabeth"
}
}
},
"g0": {
"_next": "g1",
"_expr": [
{
"word_": "Mary",
"_next": [
{
"word_": "gives",
"_next": [
{
"word_": "Shovel"
}
]
},
{
"word_": "to",
"_next": [
{
"word_": "player"
}
]
}
]
}
],
"_interpr": {
"_subject": "Mary",
"_predicate": {
"_verb": "gives to",
"_direct": "Shovel",
"_indirect": "player"
}
}
}
}
}
I want to check on a couple of things :
- the format is valid
- it has a “_entries” field
- it has a “_flow” field
- every “g(x)” element has an “_interpr” field
How do I do this?
Thanks in advance to anyone who can help me!