Forum Discussion

lindabusdiecker's avatar
lindabusdiecker
Brass Contributor
Oct 22, 2019

JSON view and column formatting

I've been interested in JSON view and column formatting after seeing various demos by https://twitter.com/theChrisKent.  I've done some cool stuff, but was asked this morning about long-term maintainability. I'm an SCA with about 200 sites (and without farm admin rights), and I'm getting down to in-depth formatting of views and columns where you're hand-crafting JSON and then putting it in text entry fields. Some of what you can do with the JSON is very brittle.  And my boss doesn't like the idea of me implementing things that someone else couldn't come across and easily support. There's also the ongoing concern about changes to SharePoint Online potentially breaking things that are already in place.

 

I'd like to hear thoughts anyone has on the long-term implications of using JSON to do view and column formatting.

 

Thanks!

7 Replies

  • Robin Nilsson's avatar
    Robin Nilsson
    Bronze Contributor

    lindabusdiecker 

    It's always a concern, 'customizating' SharePoint to do what you need. But the way they're doing the column/view formatting with JSON - I like that it's a bit more lightweight than customizing with Javascript - and the way they do it is pretty insulated from the actual structure of the page. And if you break something, it's usually only limited to that list/page - it's not something that will necessarily take down your whole site.

     

    As to breaking, I'm sure MS will eventually put in a change and break something, or stop supporting a feature. They've had breaking changes since SharePoint 2007 - but I've only run into maybe 2 changes in 13 years where I had to recode anything. 

     

    I do wish they'd allow us to use a link to a separate file of JSON custom data - that would at least prevent the total loss of data if someone deletes it accidentally. It is concerning that a site user could totally destroy your customization, since on teams sites especially they have Edit control.

     

    For now, I'm using a DevOps project and putting all my SharePoint column and view customizations in there (using VS Code to keep a local working copy and using a DevOps connector to Teams to log the commits). My file names contain the site/list/view/column name. At least then I've got a standard place to copy/paste from, I can control who has access, and we can see changes that are made. Granted I can't directly push the code. but it's better than burying the code on a network share somewhere. See if your work is using DevOps and if they'd let your create a new organization to hold your SharePoint customizations.

     

    And as for others picking it up, I working on documentation in the DevOps readme - with links to how JSON works, the links to the Microsoft Documentation site, and instructions for setting up VSCode to commit to DevOps.

     

    So, just some of my general thoughts...

    • lindabusdiecker's avatar
      lindabusdiecker
      Brass Contributor

      Robin Nilsson THANK YOU for your speedy and thorough response!

       

      I totally agree with you about being able to reference a JSON file - I'm creating a JSON file and storing it in Site Assets to help document, but that takes manual updating in two places, which typically doesn't get handled. I'm also trying to create a single document that I can use as a reference, pulling together information from a number of sources that I figure will help me work faster, but ...

       

      I was thinking since you and I both like the idea of referencing a file that one of us should create a UserVoice entry, and found that there actually is one, but it had only one vote, as did some other SharePoint UserVoice entries about JSON. Perhaps a better way to approach it is to create an entry that is more inclusive of various ideas? E.g. "Enhance view and column formatting" to be something like (more ideas would be wonderful):

       

      Enhance view and column formatting

      • Provide an out of the box facility via the web interface to allow users to make selections to modify the formatting rather than having to generate the JSON themselves.
      • Allow the JSON to be specified with a file reference rather than having to put the code directly in a field. (See also user voice entry: Allow View Formatting to reference external file, https://sharepoint.uservoice.com/forums/329214-sites-and-collaboration/suggestions/35836723-allow-view-formatting-to-reference-external-file).
      • Prompt for updating view formatting JSON when someone with appropriate rights changes the display width of a field.
      • Allow the Name field for a document to be formatted via view formatting and improve the formatting capabilities via column formatting (some things can be done using @currentField)
      • Allow comments in JSON used for formatting (or at least provide tools to limit VS Code to allow only what SharePoint JSON formatting allows)
        - Display an indicator on the list or library Settings page for each column that has column formatting set.
        - Provide JSON formatting controls to modify grouping display.

       

      • Robin Nilsson's avatar
        Robin Nilsson
        Bronze Contributor
        That looks great - you did the thinking work there , go ahead and post the UserVoice so it's in your name and I'll vote and get some other visibility to it.

Resources