I have a JSON object which looks like this:
[
objA={
"name" : "Joe",
"age" : 22,
"hobbies" : ["Skiing", "Running"]
},
objB={
"name" : "Rebecca",
"age" : 34,
"hobbies" : ["Football", "Archery"]
}
]
I'm having trouble writing a for loop which will print the name, age and hobbies of each object.
I'm getting the JSON object from another file using:
$.getJSON("data/hobbies.json", test);
Where test
is the function which the data will be used in.
How can I achieve this?