faizy faizy - 5 months ago 22
JSON Question

how to fetch json data from external file in jquery

I want to fetch all the data from external json file and print in the console, but it is not fetching data to console. Can anyone help me to solve this.

"slug": "allsopp-allsopp",
"id": 401,
"imageToken": "d045e18526f988cceb63b08e71180fb6595d9f27",
"name": "Allsopp & Allsopp",
"location": "Dubai",
"description": "Allsopp & Allsopp is a family founded property services company operating a traditional UK estate agency model in the United Arab Emirates (UAE). Our mandate is to deliver levels of customer care well above prevailing industry benchmarks, in a rapid and result oriented fashion which adheres strictly to the regulatory framework now governing the local property market. Consequently the staff we employ are expected to follow a business methodology which demands exceptional honesty, a stringent code of business conduct and total transparency to the client. The key objective at Allsopp & Allsopp is to be an all embracing property service centre that caters to all types of property related transactions in the UAE.",
"residentialForRentCount": 521,
"residentialForSaleCount": 1114,
"commercialForRentCount": 1,
"commercialForSaleCount": 0,
"commercialTotalCount": 1,
"totalProperties": 1636,
"agentCount": 57,
"licenseLabel": "RERA",
"licenseNumber": "1815",
"phone": "+971 4 429 4444",
"links": {
"self": "/en/broker/allsopp-allsopp-401",
"logo": "https://www.propertyfinder.ae/images/pf_broker/logo/d045e18526f988cceb63b08e71180fb6595d9f27/desktop",
"logo2x": "https://www.propertyfinder.ae/images/pf_broker/logo/d045e18526f988cceb63b08e71180fb6595d9f27/desktop2x"

jquery code

$(document).ready(function () {
$.getJSON('data.json', function(data) {


You can try with below.

  1. Check your json file is placed with application root folder or not. If any other path, Change the JSON URL path in script.

  2. Add JSON.Stringify() in your function.