Hi. I need to pass JSON-data to unity through a text file. I’ve been using simpleJSON and I’ve got the data into unity the way I want it, but I just can’t find an easy way of looping through/accessing or finding specific keys in the JSON object, which I need to do often.
So, my question is, how can I “translate” the JSON-object to a standard multidimensional associative JS list/array (I get confused, I’ve been learning JS, PHP and Python simultaneously) so that it’s easier to use? I’m not a complete noob, but the “object” part in “object oriented” is still largely a mystery to me.
Here’s the JSON data I’ve been testing with:
{
"Apple": {
"ingameName" : "Apple",
"description": "This sure is an apple",
"action": "options",
"options": {
"lick_apple" : {"action" : "none", "comment" : "Tastes like pesticides"},
"eat_apple" : {"action" : "remove", "comment" : "It just vanished"},
"steal_apple" : {"action" : "take", "comment" : "I took that apple good"} },
},
"Kontorsstol": {
"ingameName" : "Kontorsstol",
"description": "It looks pretty uncomfortable",
"action": "push",
"actionParameter": 500
},
"Treasure": {
"ingameName" : "Treasure",
"description": "This is the prettiest treasure I've seen",
"action": "take",
}
}
Any help appreciated.