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
+6.9k Golang : Get Alexa ranking data example
+8.2k Golang : How to check variable or object type during runtime?
+23.7k Golang : Find biggest/largest number in array
+20.8k Golang : Get password from console input without echo or masked
+26.5k Golang : Find files by extension
+7.4k Gogland : Where to put source code files in package directory for rookie
+8k Golang : Check if integer is power of four example
+6.8k Web : How to see your website from different countries?
+11.9k Golang : Simple client-server HMAC authentication without SSL example
+8.7k Golang : Build and compile multiple source files
+9.2k Golang : Extract or copy items from map based on value