Upload JSON Object as a File into Office 365 using JavaScript (JSOM)


This post is intended to explain how to convert and upload a JSON Object into a SharePoint library using JavaScript Client Object Model.

That approach will be valid using the code inside a SharePoint Web Part, will not be valid for SP Apps or JavaScript applications running outside of SharePoint context.

Here you can see the code:

Browser Coverage

I tested it in Chrome 56 and Internet Explorer 11 and it worked.

Read more…

IMPORTANT: If you want to upload other kind of documents (more that 2 MB). Then I recommend you take a look to this post: http://sharepointcookies.com/2017/02/programmatically-uploading-large-files-client-side-to-sharepoint-2013/ from my colleague Kev.

Please, write a comment if that’s not working in your specific scenario!


Author: José Quinto
Link: https://blog.josequinto.com/2017/03/03/upload-json-object-as-a-file-into-office-365-using-javascript-jsom/
Copyright Notice: All articles in this blog are licensed under CC BY-SA 4.0 unless stating additionally.