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
+12.2k Generate salted password with OpenSSL example
+7.2k Findstr command the Grep equivalent for Windows
+8.6k Golang : Read file with ioutil
+4.5k Golang : The Tao of importing package
+6k Golang : Muxing with Martini example
+7.8k Golang : On lambda, anonymous, inline functions and function literals
+5.2k Golang : How to verify input is rune?
+5.4k Golang : Selection sort example
+18.2k Golang : Get RGBA values of each image pixel
+15.9k Golang : Capture stdout of a child process and act according to the result
+15.7k Golang : File path independent of Operating System
+7.8k Golang : Convert(cast) []byte to io.Reader type