Looking at this JSON variable:
var peopleList = {
"1": {"Name": "Lisa", "item1": "Name of Item 1"} ,
"2": {"Name": "Marty"} ,
"3": {"Name": "Jordan", "item1":"Name of Item 1", "item2":"Name of Item 2"}
}
This structure seems similar to a relational database.
Currently, I am working on a program where I need to add multiple people (1-3) and assign multiple items to each person in this variable.
One challenge I am facing is determining the getters and setters in JavaScript for this variable.
For instance, how can I add an item to "Marty"?
Also, how do I retrieve the Name for item2 belonging to "Jordan"?
I appreciate any assistance as I am still learning about JSON.
If there is a simpler way to achieve this goal that is easier to work with, I am open to suggestions.