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
+5.6k Get website traffic ranking with Similar Web or Alexa
+11.4k Golang : Fuzzy string search or approximate string matching example
+9.6k Golang : Find correlation coefficient example
+26.2k Golang : Calculate future date with time.Add() function
+6.1k Linux/Unix : Commands that you need to be careful about
+12.3k Golang : Search and extract certain XML data example
+15.5k Golang : Get checkbox or extract multipart form data value example
+6.4k Golang : Spell checking with ispell example
+6k Golang : Extract XML attribute data with attr field tag example
+13k Golang : How to get a user home directory path?
+9.1k Golang : does not implement flag.Value (missing Set method)
+13.3k Golang : Count number of runes in string