javascript - How to display Json Data getting [object object]? -


$.getjson('data.json', function (data) {     $.each(data.questions, function (index, data) {         console.log(data);     }); }); // getjson 

data json:

{     "questions": [         {             "qset": {                 "q1": "template 1 question1",                 "q2": "template 1 question2",                 "q3": "template 1 question3",                 "q4": "template 1 question4",                 "q5": "template 1 question5"             }         },         {             "qset": {                 "q1": "template 2 question1",                 "q2": "template 2 question2",                 "q3": "template 2 question3",                 "q4": "template 2 question4",                 "q5": "template 2 question5"             }         },     ] } 

just validate json,then try console json properties

{     "questions": [         {             "qset": {                 "q1": "template 1 question1",                 "q2": "template 1 question2",                 "q3": "template 1 question3",                 "q4": "template 1 question4",                 "q5": "template 1 question5"             }         },         {             "qset": {                 "q1": "template 2 question1",                 "q2": "template 2 question2",                 "q3": "template 2 question3",                 "q4": "template 2 question4",                 "q5": "template 2 question5"             }         } //remove comma     ] } 

Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -