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
+6.5k Golang : Routes multiplexer routing example with regular expression control
+11.2k Golang : reCAPTCHA example
+15.4k Golang : Implement getters and setters
+10.1k Swift : Convert (cast) Int or int32 value to CGFloat
+5.5k Golang : Process json data with Jason package
+24k Golang : Find files by extension
+5.6k Golang : Scanf function weird error in Windows
+8.2k Golang : Underscore string example
+18.9k Golang : How to get time zone and load different time zone?
+6.7k Golang : Executing and evaluating nested loop in html template
+7.2k Random number generation with crypto/rand in Go
+17.5k nginx: [emerg] unknown directive "passenger_enabled"