-1

I am building my own Json and I was just wondering if you could make a list of Json objects like this "familyList":{} instead of "familyList":[ {}, {}, {}] because in the one with the '{' instead of the usual '[' you can put a key next to the {} like "Mother":{} which will be easier for me to sort through since I will be having a lot of data instead of having to open multiple brackets like this: {}, {}, {}. I am relatively new to JSON so an answer would be greatly appreciated :) !

2
  • If you use { } then it's not a list, it's an object. Commented Feb 14, 2021 at 21:18
  • Short answer: "No". Lists are [...], objects are {...} Commented Feb 14, 2021 at 21:36

1 Answer 1

0

If i understand you correctly you want something like this:

familyList = {{}, {}, {}}; 

I do not believe that is valid json. Perhaps, the below is what you are looking for.

familyList = {"Mother": {}, "Father": {} } 

Maybe there is something in this link that could help: enter link description here

Sign up to request clarification or add additional context in comments.

2 Comments

Ye I would like to do something like familyList = {"Mother": {}, "Father": {} }, is that possible?
Yes that is very possible

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.