Skip to main content
Post Undeleted by RayShawnOfNapalm
Code had a flaw, fixed that flaw. Also removed some tabs.
Source Link

I have found the solution. First I add a JsonValue to my map object. Then I add a String list to my map object as well. JsonValue has this handy method called Child, wich allows me to loop through every child in the JsonValue, wich I add to my list of Strings.

The code looks like this.

 newMap.actorstorage = saveJson.get("actors");   for (JsonValue actor = newMap.actorstorage.child; actor != null; actor = actor.next){   for(int c = 0; c < actor.size; c++){  newMap.actors.add(actor.getString("name"c));   } } 

Wich returns something like this

[name1,name2] 

I have found the solution. First I add a JsonValue to my map object. Then I add a String list to my map object as well. JsonValue has this handy method called Child, wich allows me to loop through every child in the JsonValue, wich I add to my list of Strings.

The code looks like this.

 newMap.actorstorage = saveJson.get("actors");   for (JsonValue actor = newMap.actorstorage.child; actor != null; actor = actor.next){ newMap.actors.add(actor.getString("name"));   } 

I have found the solution. First I add a JsonValue to my map object. Then I add a String list to my map object as well. JsonValue has this handy method called Child, wich allows me to loop through every child in the JsonValue, wich I add to my list of Strings.

The code looks like this.

newMap.actorstorage = saveJson.get("actors"); for (JsonValue actor = newMap.actorstorage.child; actor != null; actor = actor.next){   for(int c = 0; c < actor.size; c++){  newMap.actors.add(actor.getString(c)); } } 

Wich returns something like this

[name1,name2] 
Post Deleted by RayShawnOfNapalm
Source Link

I have found the solution. First I add a JsonValue to my map object. Then I add a String list to my map object as well. JsonValue has this handy method called Child, wich allows me to loop through every child in the JsonValue, wich I add to my list of Strings.

The code looks like this.

 newMap.actorstorage = saveJson.get("actors"); for (JsonValue actor = newMap.actorstorage.child; actor != null; actor = actor.next){ newMap.actors.add(actor.getString("name")); }