0

I am trying to loop through some JSON code but it's a bit more complicated than a simple $.each(data, function(key, value){}; as you can see, the JSON is wrapped once again. when i just use $.each(data, function(key, value){};i get: data : [object Object],[object Object],[object Object],[object Object],[object Object],[object Object]. How can i get the data inside the subobjects?

Thanks!

{
  "data": [
    {
      "title": "nummer 6",
      "application": "afbeeldingVerhalen",
      "language": "de_DE",
      "id": "",
      "image": ""
    },
    {
      "objAudio": "",
      "objImage": "",
      "objText": "",
      "objLocation": {
        "X": "70.99527740478516",
        "Y": "166.853759765625"
      }
    },
    {
      "objAudio": "",
      "objImage": "",
      "objText": "",
      "objLocation": {
        "X": "70.99527740478516",
        "Y": "166.853759765625"
      }
    }
  ]
}

Edit

Thanks for the link i found out how to fix it:

$.each(data['data'], function(key, value){
        $.each(data['data'][key], function(key, value){
            console.log(value);
        });
    });

0 Answers0