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
+13k Golang : Convert(cast) int to int64
+6.2k Golang : Detect face in uploaded photo like GPlus
+6.3k Golang : Handling image beyond OpenCV video capture boundary
+25.5k Golang : Daemonizing a simple web server process example
+22.8k Golang : Gorilla mux routing example
+20k Golang : Convert seconds to human readable time format example
+5.7k Javascript : How to replace HTML inside <div>?
+47.8k Golang : How to convert JSON string to map and slice
+9.6k Golang : Detect number of active displays and the display's resolution
+29.7k Golang : Get and Set User-Agent examples
+5.9k Fix ERROR 2003 (HY000): Can't connect to MySQL server on 'IP address' (111)
+15.9k Golang : How to reverse elements order in map ?