Use a JSON array with objects with javascript

I have a function that will get a JSON array with objects. In the function I will be able to loop through the array, access a property and use that property. Like this:

Variable that I will pass to the function will look like this:

[{
  "id": 28,
  "Title": "Sweden"
}, {
  "id": 56,
  "Title": "USA"
}, {
  "id": 89,
  "Title": "England"
}]

function test(myJSON) {
  // maybe parse my the JSON variable?
  // and then I want to loop through it and access my IDs and my titles
}

Any suggestions how I can solve it?

Leave a Comment