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
+8.9k Golang : Web(Javascript) to server-side websocket example
+8.1k Golang : Progress bar with ∎ character
+5.7k Golang : Debug with Godebug
+6.4k Get Facebook friends working in same company
+14.5k Golang : Accurate and reliable decimal calculations
+8.8k Golang : Temperatures conversion example
+7.5k Golang : Get all countries phone codes
+5.5k Facebook : How to force facebook to scrape latest URL link data?
+12.3k Golang : Convert int(year) to time.Time type
+10.1k Golang : Underscore string example
+23.3k Golang : Use regular expression to validate domain name