After receiving an HTTP response in the form of a JSON file, how can I handle my simple content using jQuery?
I have done this before, but I just can’t understand how it is now.
I use this function to retrieve JSON content.
var json = $.getJSON("test.json",
function(response){
}
);
Of course, I can process the data contained in JSON, but I would like to process and print my simple content, for example:
{"name": "Pepe","age" : "20"}
Following
alert(response);
Just gives me [object Object]
And this one
alert(jQuery.parseJSON(json));
Just gives me null
I can not find the answer anywhere. I am new to this, so I have to use the wrong search terms because it looks like a trivial question.
source
share