XML is dead – long live JSON

By Dave Paylor, Repost from WordPress

While I loved the power of XSLT – you may have noticed from some of my other posts – I was never really a big fan of XML.  Yes, I used it when I had to but it always seemed like a lot of effort to get anywhere – and don’t get me started on the fun (??) I have had parsing poorly formatted XML.

JSON on the other hand – I almost look for excuses to use it.

In SharePoint, JSON is gradually becoming increasingly prevalent while the use of XML almost seems to be limited to legacy needs.

So what can we do with JSON in SharePoint?

JSON Editor

Firstly, this almost went unnoticed, but JSON is now a recognised document format in O365 and even has its own online editor.  So you can save a JSON document to a SharePoint library and select preview to view and open to edit.  Also nice to manage version control.

JSONEditor

Column Formatting

While I am still in mourning over the premature demise of JSLink – yes I know it is still there but I am sure the writing must be on the wall – I am encouraged that we can now customise how columns appear using JSON.

ColumnFormat.PNG

There are some good posts on this to get you started such as:

Use column formatting to customize SharePoint

For those who have been following along for a while, this is a nice logical next step from XSL Link and JSLink, allowing non-developers to apply some simple formatting to SharePoint list columns.  However, it does feel a bit unfinished.  I am hopeful it will mature a bit over time to provide more capability but at the moment it definitely feels a bit constrained.

Site Themes

If you have not tried it yet take a quick look at the Theme Generator.

ThemeGenerator.PNG

This is a great tool to create custom colour themes for SharePoint – and guess what format the output is to apply to your site?  JSON of course!

Again, Microsoft have provided some good posts on using this:

SharePoint site theming

However, note that this only applies to the new style of SharePoint sites.  You cannot just apply these to the more traditional team sites etc.

Site Configuration

Also just for the new style of SharePoint sites, JSON can even be used to customise sites.  Create a content type, add a list, apply a theme, even trigger a Flow – and all using JSON.

1
2
3
4
5
6
7
8
9
{
"verb": "createSPList",
"listName": "Customer Tracking",
"templateType": 100,
"subactions": [{
"verb": "setDescription",
"description": "List of Customers and Orders"
}]
}

Site design JSON schema

This is a great way of setting up templates and ensuring new sites can be provisioned in a consistent way.  However, I have to say that while the JSON is relatively straightforward, applying it is a bit more of a challenge.

Digital Workplace Conference

I will be presenting all this and more at the Digital Workplace Conference in Melbourne on 15-16 August 2018.  Come along and say hello.