I do not have much intimacy with JSON and I need to create a structure that contains a list of stores separated by categories, where each store item has some information (name, floor, phone, etc.). each category, but I would like everything to be in an object only to be able to iterate later.
I've tried something like below but it's not working very well:
var ljs = {
"categ": "Loja de Departamentos",
"lojas": [
{
nome: "LOJA A",
piso: "1",
tel: "",
desc: "descrição da loja.",
imagem: "logo_a.jpg"
},
{
nome: "LOJA B",
piso: "1",
tel: "",
desc: "descrição da loja.",
imagem: "logo_b.jpg"
}
]
};
In addition to "categ": "Loja de Departamentos"
they will also have several other categories, such as Docerias, Restaurants etc. I believe the "lojas"
key is even unnecessary.
How can I mount a JSON of this type, listing the categories and the list of stores for each, and then I can pull the data with a for
?