SharePoint List Form Formatting JSON Examples on GitHub

SharePoint list form formatting can significantly enhance the user experience and improve data input accuracy. JSON, a lightweight data interchange format, plays a crucial role in customizing list forms. This article explores SharePoint list form formatting using JSON, with examples inspired by GitHub's open-source community.

How to customize Forms in SharePoint Lists 📃
How to customize Forms in SharePoint Lists 📃

Before delving into JSON examples, let's understand the basics. SharePoint list form formatting allows you to modify the appearance and behavior of list forms using JSON, CSS, and HTML. This flexibility enables you to create intuitive, user-friendly forms that align with your organization's branding and workflows.

Display SharePoint List Items in a SPFX Web Part [Tabular Format]
Display SharePoint List Items in a SPFX Web Part [Tabular Format]

Understanding SharePoint List Form JSON Schema

SharePoint list form JSON schema defines the structure and properties of your list form. It consists of various sections like 'contentTypes', 'fields', 'views', and 'commands'. Familiarizing yourself with these sections is crucial for effective JSON formatting.

Add Conditional Formatting to a SharePoint Online List
Add Conditional Formatting to a SharePoint Online List

Here's a basic JSON schema example to get you started:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/formatting",
  "contentTypes": {
    "Item": {
      "fields": {
        "Title": { "control": { "type": "Text" } },
        "Description": { "control": { "type": "MultiLineText" } }
      }
    }
  }
}

Formatting List Form Fields

Some Top Reasons to Use SharePoint
Some Top Reasons to Use SharePoint

JSON formatting allows you to customize individual fields in your list form. You can change the control type, set default values, or apply conditional formatting.

Let's look at an example where we change the 'Title' field to a dropdown list with predefined options:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/formatting",
  "contentTypes": {
    "Item": {
      "fields": {
        "Title": {
          "control": {
            "type": "ChoiceGroup",
            "options": {
              "choices": [
                { "text": "Option 1", "value": "Option 1" },
                { "text": "Option 2", "value": "Option 2" },
                { "text": "Option 3", "value": "Option 3" }
              ]
            }
          }
        }
      }
    }
  }
}

Customizing List Form Views

How to Personalize SharePoint for Users
How to Personalize SharePoint for Users

JSON formatting also enables you to modify list form views. You can change the layout, add or remove columns, or adjust the view's title.

Here's an example of how to create a new view called 'My Custom View' with a different layout:

{
  "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/formatting",
  "views": [
    {
      "id": "MyCustomView",
      "view": {
        "type": "Custom",
        "layout": "300",
        "title": "My Custom View"
      }
    }
  ]
}

Exploring JSON Formatting Examples on GitHub

Learn How To Create a Sharepoint Online List From an Excel Spreadsheet
Learn How To Create a Sharepoint Online List From an Excel Spreadsheet

GitHub hosts numerous open-source projects that provide SharePoint list form JSON formatting examples. These examples can serve as a great starting point or inspiration for your own projects.

One such project is 'sharepoint-json-formatting-examples' by Vesa Juvonen (GitHub link). This repository contains various JSON formatting examples, including conditional formatting, field customization, and view modifications.

Git & GitHub Cheat Sheet 🔥 | Commands, Workflow, Branching & Version Control (Beginner to Pro)
Git & GitHub Cheat Sheet 🔥 | Commands, Workflow, Branching & Version Control (Beginner to Pro)
How to track documents in SharePoint using Document ID feature | SharePoint Maven
How to track documents in SharePoint using Document ID feature | SharePoint Maven
Step-by-Step Guide: Syncing SharePoint List to Power Pages Table
Step-by-Step Guide: Syncing SharePoint List to Power Pages Table
SharePoint Page Section Templates Explained
SharePoint Page Section Templates Explained
How to Create a Custom Permission Level in SharePoint
How to Create a Custom Permission Level in SharePoint
SharePoint Content Types - BoostSolutions
SharePoint Content Types - BoostSolutions
a poster with different types of text and pictures on the front page, including an image of
a poster with different types of text and pictures on the front page, including an image of
How To Create A Page In SharePoint: A Step-By-Step Guide
How To Create A Page In SharePoint: A Step-By-Step Guide
Why You Should Never Embed Document Libraries and Lists into SharePoint Pages
Why You Should Never Embed Document Libraries and Lists into SharePoint Pages
SharePoint Tutorial #2 - SharePoint Document Library
SharePoint Tutorial #2 - SharePoint Document Library
How to Make Any SharePoint Page the New Homepage
How to Make Any SharePoint Page the New Homepage
How to Get Started with SharePoint Look Book
How to Get Started with SharePoint Look Book
GitHub Quick Guide: Essential Tips for Developers & Teams 📖
GitHub Quick Guide: Essential Tips for Developers & Teams 📖
Site Collections, Sites, Pages, Document Libraries, and Folders - putting it all together | SharePoint Maven
Site Collections, Sites, Pages, Document Libraries, and Folders - putting it all together | SharePoint Maven
The Only Git Cheat Sheet You’ll Ever Need 🛠 ​Hashtags: #aitechworlds #aitechworldsnotes #git
The Only Git Cheat Sheet You’ll Ever Need 🛠 ​Hashtags: #aitechworlds #aitechworldsnotes #git
a screen shot of the git chatsheet
a screen shot of the git chatsheet
a poster showing different types of web pages and how they are used to create them
a poster showing different types of web pages and how they are used to create them
Top 12 SharePoint Web Parts for a Powerful Intranet
Top 12 SharePoint Web Parts for a Powerful Intranet
8 Effective Ways To Make Your SharePoint Site Interactive
8 Effective Ways To Make Your SharePoint Site Interactive
a poster with information about the different types of software
a poster with information about the different types of software

Learning from Real-world Examples

Browsing through these examples can help you understand how JSON formatting can be applied to solve real-world problems. You can learn how others have tackled challenges similar to yours and adapt their solutions to fit your needs.

For instance, you might find examples of how to create a dropdown list with data sourced from another SharePoint list, or how to display a person or group field as a hyperlink that opens the user's profile.

Contributing to the Community

Once you've gained experience with SharePoint list form JSON formatting, consider giving back to the community by contributing your own examples to open-source projects. This not only helps others but also serves as a great way to solidify your own understanding.

Before contributing, make sure to follow the project's guidelines and submit a pull request with a clear, concise description of your changes.

In the ever-evolving world of SharePoint, JSON formatting continues to play a pivotal role in enhancing user experiences and streamlining workflows. By mastering JSON formatting and leveraging the wealth of examples available on GitHub, you can unlock the full potential of SharePoint list forms for your organization.