Do all "objects" (I hope thats what they are called) have to have the same info in them. my example that I am working with.
{
"name": "Grapes",
"purchase_price":[
{"Pierres's": 60},
{"JojaMart": 75},
{"Traveling Cart": null}
],
"sell_price":[
{"Base": 80},
{"Silver": 100},
{"Gold": 120},
{"Iridium": 160}
],
"is_multi_harvest": false
}
And this is another example where you can only "buy" an item from a different person and not the others.
{
"name": "Ancient Fruit",
"purchase_price":[
{"Pierres's": null},
{"JojaMart": null},
{"Traveling Cart": 1000},
{"Oasis": null}
],
"sell_price":[
{"Base": 550},
{"Silver": 684},
{"Gold": 825},
{"Iridium": 1100}
],
"is_multi_harvest": false,
"notes": null
}
so in both examples, can I just get rid of the ones with "null" for them since you can't purchase it from them at all, or must I have them and give them this value?
CodePudding user response:
No, nothing in the JSON Specification requires all elements in a list to have the same shape.
JSON is a set of rules about how to express data, what you put in it is all on you.