DEV Community

Andrew Petersen
Andrew Petersen

Posted on


SharePoint Rest API Formatter

Before stumbling across the article, Userscripts Are Fun And Are Still Very Much Relevant, I had never heard of Userscripts. They are pretty useful; kind of like a bare bones browser extension.

The first thing I created was a helper to format and syntax highlight the XML that comes back when navigating to a SharePoint REST endpoint in Chrome or Edge.

Userscript automatically kicks in on all REST API urls
End Result

Without it, it'd look like this
Raw XML Response

Previous Solutions/Attempts

  • I've installed Chrome Extensions to automatically format/syntax highlight XML, but they perform mediocre at best
  • I've experimented with Chrome Extensions to automatically set the request headers to application/json, but that inevitably causes problems when I forget to turn it off, and sometimes I prefer the ATOM/XML response because it shows you what child properties you can expand on.


  1. Format and syntax highlight the XML response
  2. Provide a toggle to switch between XML or JSON response

Install Steps

  1. Install the ViolentMonkey Chrome Extension
    • This is what manages all your Userscripts.
    • It's a weird name, but it has worked great so far.
  2. Add a new User Script from URL
    • Open the ViolentMonkey extension Dashboard,
    • Then click "New Script from Url" and paste in the following url.
    • It's the raw url to this Gist, which is the result of my efforts. Definitely take a look at the code if you're interested.

Latest comments (0)

Timeless DEV post...

Git Concepts I Wish I Knew Years Ago

The most used technology by developers is not Javascript.

It's not Python or HTML.

It hardly even gets mentioned in interviews or listed as a pre-requisite for jobs.

I'm talking about Git and version control of course.

One does not simply learn git