I tried to look for an answer for this on google but I don’t know what the correct term for my problem is. Also, as you might have guessed I am new to Kotlin.
I am generating a nested JSON with gson with the root being this:
private data class MasterJson(val ships: MutableList<PlayerShipJson>)
That results in a JSON that is structured like this:
when I check the path for it there is an anonymous object that is represented in the path like this:
$.ships.. I presume that anonymous object comes from the fact that I am passing a mutable list to the Array and it represents the index of that array.
I want to access the objects in this JSON but I do not know what syntax to use to access objects past that anonymous object.
jsonObject.getJSONObject([i]) for example does not work.
Suggestions on: A give that anonymous object a name on generation.
or B. how to access it would be greatly appreciated.