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
+4.8k Javascript : How to refresh page with JQuery ?
+18k Golang : How to get own program name during runtime ?
+6.9k Golang : get the current working directory of a running program
+5.1k Golang : Dealing with backquote
+4.3k Golang : The Tao of importing package
+53.3k Golang : Unmarshal JSON from http response
+4.6k Golang : Shortening import identifier
+12k Golang : List objects in AWS S3 bucket
+22.2k Golang : Print out struct values in string format
+4.2k Golang : Display packages names during compilation
+19.9k Golang : Get password from console input without echo or masked
+12.9k Golang : Check if a file exist or not