Json for towns and shops

Hello, i want to make a Json that list the shops in each town so i thought

{ "towns" : [
    {"id":1, "name":"townName", "shops" : [
         {"Blacksmith":true, "x":1, "y":1, "z":1},
         {"Inn":true, "x":2, "y":2, "z": 2}
         ........
     ]
     }
     {"id:2, "name":"town2", ......
     }
]
}

is this type of json doable and if yes how do i access to Blacksmith parameters? Thanks

towns is an array object so you can access the array of towns like so: towns[i].

Within each object in that array, there is a property for shops which is also an array object that you can access like: towns[i],shops[j].

So towns[0].shops[0] would return {"Blacksmith":true, "x":1, "y":1, "z":1}

Thanks @yaustar i thought of semplify it in towns with id:1 Blacksmith:true …etc etc without the sub shops since i don’t really needed the town name but just the id :slight_smile:

I probably wouldn’t do:

"Blacksmith": true

Instead, I’d do:

"type": "blacksmith"
1 Like

I have used “Blacksmith”: true because if false it put an House instead a shop to not leave an empty space if just used “type”: “nameofshop” i couldn’t check if shop is present or not