Why is my json file not found?

Solution is you need to add json file extension type in MIME Types

Method 1

Go to IIS, Select your application and Find MIME Types

enter image description here

Click on Add from Right panel

File Name Extension = .json

MIME Type = application/json

enter image description here

After adding .json file type in MIME Types, Restart IIS and try to access json file


Method 2

Go to web.config of that application and add this lines in it

 <system.webServer>
   <staticContent>
     <mimeMap fileExtension=".json" mimeType="application/json" />
   </staticContent>
 </system.webServer>

Try putting the *.json file in the webRoot, not in a sub folder. And then reference it like:

$.getJSON('NBCCJr.json', function (data) {

This of course requires the previous inclusion and instantiation of the jQuery system object from: jquery.min.js or the JSON structure from: json2-1.0.min.js


I Changed .json to .txt and request is working fine. I am not sure about the consequence .txt can cause.


Have you tried removing the ~ ?

As in:

$.getJSON('/Content/dumboJr.json', function (data) {
    $.each(data, function(i, dataPoint) {
        // Bla
      });
  });
)

To allow the IIS to serve JSON files, try adding this to your web.config:

<staticContent>
    <mimeMap fileExtension=".json" mimeType="application/json" />
</staticContent>