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
+37.7k Golang : How to read CSV file
+7k Swift : Convert (cast) String to Float
+7.7k Golang : Accept any number of function arguments with three dots(...)
+26.8k Golang : Read, Write(Create) and Delete Cookie example
+5k Fontello : How to load and use fonts?
+12.6k Javascript : Prompt confirmation before exit
+9.1k Golang : Read file and convert content to string
+4.4k Golang : Generate Interleaved 2 inch by 5 inch barcode
+4.5k Golang : fmt.Println prints out empty data from struct
+7.9k Golang : Write multiple lines or divide string into multiple lines
+7.6k Golang : How to find out similarity between two strings with Jaro-Winkler Distance?
+20.6k Golang : How to reverse slice or array elements order