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.4k Python : Delay with time.sleep() function example
+7.9k Golang : Take screen shot of browser with JQuery example
+7.8k Golang : GMail API create and send draft with simple upload attachment example
+6.8k Golang : Reverse a string with unicode
+25.1k Golang : Calculate future date with time.Add() function
+16.5k Golang : Simple client server example
+8.4k Golang : Accessing content anonymously with Tor
+7.1k Golang : Auto-generate reply email with text/template package
+6.3k Golang : Process json data with Jason package
+45.5k Golang : Convert int to byte array([]byte)