Hello, I'm using Gson to take JSON from an api and put it into classes; however, I've come across a problem. I'm looking for a way to keep track of what parts belong to what larger parts. As an example:
Lets say I have a base class that holds all the information, and inside that class Lists are populated using Gson. Those Lists must then be put into other classes, and inside those classes new Lists are formed. It's hard to track which part come from what. Right now I'm using multi-dimensional arrays, but it's getting rather complex to keep this going. Here is an example of the JSON:
{ "item":1, "item":2, "list":[ { "item":1, "item":2, "list":[ { "item":1, "item":2, "list":[ { "item":1, "item":2 } ] } ] } ] }
A big problem is when there are multiple Lists in a class, and a class array is made. A class could have 6 different instances, but only 3 belong to another class instance, and the other 3 to another. It's hard to explain. I need a better way to do this, any suggestions? Thanks, and sorry if this is confusing.