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
+9.1k Golang : Changing a RGBA image number of channels with OpenCV
+15.1k Chrome : ERR_INSECURE_RESPONSE and allow Chrome browser to load insecure content
+4.3k Linux : sudo yum updates not working
+14.6k Golang : Accurate and reliable decimal calculations
+12.1k Android Studio : Highlight ImageButton when pressed on example
+19k Golang : Get current URL example
+20k Golang : Secure(TLS) connection between server and client
+14.3k Golang : Adding XML attributes to xml data or use attribute to differentiate a common tag name
+13.7k Golang : syscall.Socket example
+14.7k Golang : Get all local users and print out their home directory, description and group id
+5.6k Golang : Function as an argument type example
+11.2k Golang : Display a text file line by line with line number example