Devo
❔ Access dynamic amount of keys in a deserialized JSON using Newton JSON in Unity
Hello, I've been trying to modify this project https://github.com/n1c/csgo-gsi-radar-unity/ to get it to work for Dota2 for an uni project (I'm a designer, not a programmer).
My problem is that I need a dynamic amount of keys, since Dota2 can have hundreds of things happening on the map and I have no idea how to properly implement that and can't just hardcode everything due to the high amount.
This would be an example of parsing JSON https://pastebin.com/AfmHGTTN
I basically have to compare key similar to here https://github.com/n1c/csgo-gsi-radar-unity/blob/master/Assets/Scripts/Drawer.cs#L23 and check if for example
player
and hero
have that key and then get the innerkeys + values from it.
A CSGO JSON would for example (shorten down) look like this https://pastebin.com/q6CsGLtS where you don't have multiple level of innerkeys in player
to find the data in allplayers
The deserialization starts here:
https://github.com/n1c/csgo-gsi-radar-unity/blob/master/Assets/Scripts/Listener.cs#L78
And here is the structure for CSGO
https://github.com/n1c/csgo-gsi-radar-unity/blob/master/Assets/Libs/PayloadModels.cs
I'd be really happy if someone can help me out with this.2 replies