13

I'm trying to build a lightweight reporting tool consisting of an HTML file that would sit in a document library and consume data from JSON files residing in the same folder. The JSON file type is blocked, though, and IT seem unwilling to make an exception to the default rules, citing "risks".

What are the risks? What is a possible workaround? Thanks!

  • 2
    this is no risk there is a guarantee; 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. – user18571 Aug 31 '17 at 14:56
11

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).

  • Turns out the .txt extension works fine in jQuery. Thanks for this answer, and your other suggestions! – America Sep 9 '14 at 17:29
  • 1
    Instead of .txt use .js That will make sure any IDE you use formats your file as JSON – Danny '365CSI' Engelman Sep 22 '16 at 18:59
13

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.

  • 1
    Do you have a source that you're quoting? I can't find this quote on the interwebs. – jpaugh Aug 30 '17 at 18:20
0

I guys, Actually I don't have a reputation so I can add comments, but this and may help full for the guy who is looking for the how to get the data in Sharepoint

thanks @Jarrod Roberson, got hint from your ans

how i have archived this task

var Icons = $.get("Text.txt", function(data) {
                IconsList = JSON.parse(data);
                MenuMaker(_L, _M, DList, IconsList);
            }).fail(function() {
                alert("Something went worng");
            });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.