How can I create a 2D array using a JSON file?
“tile_size”: 16,
“map_width”: 101,
“map_height”: 37,
“layers”: [
{
“name”: “bg”,
“positions”: [
{ “x”:1, “y”:6, “id”:0 },
{ “x”:1, “y”:7, “id”:0 },
{ “x”:1, “y”:8, “id”:0 },
{ “x”:1, “y”:9, “id”:0 },
{ “x”:1, “y”:10, “id”:0 },
{ “x”:1, “y”:11, “id”:0 },
{ “x”:1, “y”:12, “id”:0 },
{ “x”:1, “y”:13, “id”:0 },
{ “x”:1, “y”:14, “id”:0 },
{ “x”:1, “y”:15, “id”:0 },
{ “x”:1, “y”:16, “id”:0 }
]
}
]
You can use methods append() or setJSONArray() to add a new
JSONArray to your existing JSONArray: