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
+7k Mac OSX : Find large files by size
+30.6k Get client IP Address in Go
+12.4k Golang : How to display image file or expose CSS, JS files from localhost?
+9k Golang : Accept any number of function arguments with three dots(...)
+7.6k Golang : Hue, Saturation and Value(HSV) with OpenCV example
+18.8k Golang : Get download file size
+12.5k Linux : How to install driver for 600Mbps Dual Band Wifi USB Adapter
+5.8k Golang : Frobnicate or tweaking a string example
+13.8k Golang : Qt progress dialog example
+19.4k Golang : Populate dropdown with html/template example
+19.3k Golang : Execute shell command
+14.5k Golang : How to shuffle elements in array or slice?