Reputation: 1605
I have the following code for getting json data:
$.getJSON( "assessments", function( assessments ) {
console.log(assessments);
});
I am perfectly getting all the data but the console has output as
[Object, Object, Object, Object, Object, Object, Object, Object, Object]
I want to output the values in JSON structure like this:
[
{
"id": 1,
"person": {
"personId": "person1",
"firstName": "Pactric"
},
"manager": {
"managerId": "manager1"
},
"state": {
"stateId": 1,
"description": null
},
"comments": null
}
]
How to console.log() for this data to display exactly as above's JSON structure? I am using $.getJSON NOT $.ajax for this application.
Upvotes: 46
Views: 83168