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
+7.9k Golang : Scan files for certain pattern and rename part of the files
+41.6k Golang : Convert string to array/slice
+7.6k Golang : Shuffle strings array
+14.6k Golang : How to filter a map's elements for faster lookup
+15.9k Golang : Intercept Ctrl-C interrupt or kill signal and determine the signal type
+7.4k Ubuntu : connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream
+20.7k Golang : Pipe output from one os.Exec(shell command) to another command
+5.3k Responsive Google Adsense
+16.2k Golang : Get sub string example
+10.1k CodeIgniter : Load different view for mobile devices
+8k Golang : Lock executable to a specific machine with unique hash of the machine