Javascript : Read/parse JSON data from HTTP response
This is just a quick note on how to parse JSON data with Javascript. The JSON data is generated in a similar fashion as described in the unmarshalling json data from http response tutorial, but for this tutorial sake, we just keep it as a string data in JSON format.
Basically, to process JSON data with Javascript. Just used the JSON.parse()
function will do.
For example :
var jsonData := '{"Name":"Adam","Age":36,"Job":"CEO"}'
var parsedData = JSON.parse(jsonData);
document.write(parsedData.Name + ", " + parsedData.Age + ", " + parsedData.Job);
Reference :
See also : Golang : Unmarshal JSON from http response
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+9.9k Golang : Concatenate (combine) buffer data example
+14.2k Golang : Loop each day of the current month example
+15.4k Golang : How to generate QR codes?
+6.2k Golang : File system scanning
+10.6k Golang : Save webcamera frames to video file
+24.4k Golang : Get executable name behind process ID example
+5.1k Golang : Experimental emojis or emoticons icons programming language
+11.2k Elastic Search : Return all records (higher than default 10)
+27.8k Golang : JQuery AJAX post data to server and send data back to client example
+13.8k Golang : rune literal not terminated error
+16.5k Golang : Get all upper case or lower case characters from string example
+12.7k Elastic Search : Mapping date format and sort by date