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.9k Golang : How to write backslash in string?
+12k Golang : Display list of countries and ISO codes
+6.5k Android Studio : Hello World example
+5k Golang : Get FX sentiment from website example
+4.4k Javascript : Access JSON data example
+29.4k Golang : How to declare kilobyte, megabyte, gigabyte, terabyte and so on?
+4k Golang : Converting individual Jawi alphabet to Rumi(Romanized) alphabet example
+13.6k Golang : Human readable time elapsed format such as 5 days ago
+4.9k Python : Create Whois client or function example
+31.1k Golang : Example for ECDSA(Elliptic Curve Digital Signature Algorithm) package functions
+9.1k Golang : Create unique title slugs example
+37k Upload multiple files with Go