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
+4.7k Unix/Linux : secure copying between servers with SCP command examples
+11.8k Golang : Save webcamera frames to video file
+13.1k Golang : Generate Code128 barcode
+30.2k Golang : How to redirect to new page with net/http?
+13.4k Golang : reCAPTCHA example
+25.5k Golang : missing Mercurial command
+13.9k Javascript : Prompt confirmation before exit
+20.3k Golang : Secure(TLS) connection between server and client
+27.2k PHP : Convert(cast) string to bigInt
+4.6k Fix Google Analytics Redundant Hostnames problem
+29k Golang : missing Git command
+8.1k Golang : Count leading or ending zeros(any item of interest) example