JSON is used to read data from a web server, also it is used to display the data in a web page. In this blog we will be accessing the values of JSON object with the help of the jquery's getJSON() method. GetJSON() method is used to load the JSON encoded data from the server.
GetJSON() method syntax:
jQuery.getJSON( url[,data][,success] )
where, url – is a string which contains the URL to which the request is to be sent.
Data – an object that is to be sent to the server along with the request.
Success – is a callback function that is executed when the request succeeds.
Pass the following JSON string and save a file “data.json”: