Sharepoint - Why is upload of JSON files prohibited?

I had the same issue, the actual reason is completely unreasonable.

The .json extension in out of the box SharePoint is reserved for .json enabled web services, specifically the REST API for client side operations. Due to a handler in the web.config file for the application, if you were even able to upload your .json files, you would get errors trying to access them due to the handler intervening. The extension is blocked to maintain integrity within the SharePoint product, which is why aspx and other web formats are blocked.


I can't see any reason to prevent the uploading of JSON files, this file format is as harmless as XML since it only stores data, not executable code. In comparison, uploading a HTML file would be much more dangerous since it's possible to place some malicious JavaScript code on it that steals cookies from users that access it, for example.

As a possible workaround if the IT staff do not allow its upload, you could create a *.txt file with JSON content on it and consume it through your HTML file, it would not make too much difference. Or even better, you could create a SharePoint list and manipulate it using SPServices or the SharePoint client object model (CSOM).

Tags:

Json