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
+10.1k Golang : Allow Cross-Origin Resource Sharing request
+7.8k Golang : Configure Apache and NGINX to access your Go service example
+11.3k Golang : How to detect a server/machine network interface capabilities?
+4.3k Mac OSX : Get disk partitions' size, type and name
+5.5k Unix/Linux : How to test user agents blocked successfully ?
+5.9k Golang : Scan forex opportunities by Bollinger bands
+6.5k How to let Facebook Login button redirect to a particular URL ?
+8.9k Golang : How to get username from email address
+6k Unix/Linux : Use netstat to find out IP addresses served by your website server
+14.7k Golang : How to check if IP address is in range
+6.6k Golang : Levenshtein distance example
+8.5k Golang : Take screen shot of browser with JQuery example