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.5k Golang : Detect Pascal, Kebab, Screaming Snake and Camel cases
+6.1k nginx : force all pages to be SSL
+15.7k Golang : Force download file example
+14.9k Golang : Get URI segments by number and assign as variable example
+7.5k Golang : Scanf function weird error in Windows
+13k Python : Convert IPv6 address to decimal and back to IPv6
+9.5k Golang : Qt Yes No and Quit message box example
+5.9k Unix/Linux : Get reboot history or check when was the last reboot date
+20.4k Golang : How to get own program name during runtime ?
+9.8k Golang : interface - when and where to use examples
+9.6k Golang : Validate IPv6 example
+8k Golang Hello World Example