SharePoint Online List Forms JSON Formatting - SPGuides (2023)

SharePoint Online List Forms JSON Formatting - SPGuides (1)

In this SharePoint Online tutorial, we will learn how we can customize or format the SharePoint Online list forms using JSON formatting.

We can display the columns in a section-wise or group-wise manner which makes us user-friendly to use the SharePoint Online list forms. We can add one or more sections with fields to customize or format the SharePoint Online list form.

We will also learn how we can format or customize the header, footer, and body of the SharePoint List Forms using JSON formatting. Here we have covered the below topics:

  • Customize the SharePoint Online List Form Header using JSON formatting
  • Customize the SharePoint Online List Form Body using JSON formatting
  • Customize the SharePoint Online List Form Footer using JSON formatting
  • SharePoint Online List Column JSON formatting examples
  • SharePoint column JSON formatting to a Title Column
  • Add JSON formatting to a Person column in a SharePoint Online list
  • Add JSON formatting to a Date column in a SharePoint Online list
  • Add JSON formatting to a Choice column in a SharePoint Online list

Table of Contents

Customize the SharePoint Online List Form Header using JSON formatting

Let us see how we can customize or format the SharePoint Online list form header using JSON formatting,

To achieve this, follow the below steps:

  • Open the SharePoint Online list form that you want to customize or format using JSON formatting.
  • Add a + New item to display the SharePoint Online list fields in a detailed view.
  • In the New item window, Expand the Edit form icon and click on the Configure Layout option as displayed below:
SharePoint Online List Forms JSON Formatting - SPGuides (2)
  • Once the configure layout option is selected, In the Apply formatting to option select the Header option from the dropdown.
SharePoint Online List Forms JSON Formatting - SPGuides (3)
  • In the Formatting code option, apply or paste the below-mentioned JSON formatting code. To Preview the code click on the Preview button.
  • Click on the Save button to save the changes.
{ "elmType": "div", "attributes": { "class": "ms-borderColor-neutralTertiary" }, "style": { "width": "100%", "margin-bottom": "15px", "background-color": "purple" }, "children": [ { "elmType": "div", "style": { "display": "flex", "align-items": "center" }, "children": [ { "elmType": "div", "style": { "flex": "none", "padding": "0px", "padding-left": "10px", "height": "40px", "color": "white" } } ] }, { "elmType": "div", "attributes": { "class": "ms-fontColor-themePrimary ms-borderColor-themePrimary ms-fontWeight-bold ms-fontSize-xl ms-fontColor-neutralSecondary–hover ms-bgColor-themeLight–hover" }, "style": { "box-sizing": "border-box", "width": "100%", "text-align": "center", "padding": "21px 12px", "overflow": "hidden", "color": "white" }, "children": [ { "elmType": "div", "txtContent": "Task Details" } ] } ]}

In the below screenshot, you can see that the Header is added to the SharePoint Online list form.

SharePoint Online List Forms JSON Formatting - SPGuides (4)

This is how to customize or format the SharePoint Online list form header using JSON formatting.

Read SharePoint list View Tutorial

(Video) Microsoft Lists Formatting Examples | Microsoft Lists Formatting Tutorials

Customize the SharePoint Online List Form Body using JSON formatting

Let us see how to customize or format the SharePoint Online list form body using JSON formatting,

To achieve this, follow the below steps:

  • Open the SharePoint Online list form that you want to customize or format using JSON formatting.
  • Add a + New item to display the SharePoint Online list fields in a detailed view.
  • In the New item window, Expand the Edit form icon and click on the Configure Layout option as displayed below:
SharePoint Online List Forms JSON Formatting - SPGuides (5)
  • The below mentioned is the JSON structure to display the columns or fields in the SharePoint Online list in a section-wise manner or group-wise manner.
  • We can add one or more sections with fields to customize or format the SharePoint Online list form.
{ "sections": [ { //We can mention the display name for the section "displayname": "", "fields": [ //We can add the fields that we want to display in this section "Title" ] }, { //give a display name for the section "displayname": "", "fields": [ //reference your fields here using their display name ] } ]}
  • Once the configure layout option is selected, In the Apply formatting to option select the Body option from the dropdown.
SharePoint Online List Forms JSON Formatting - SPGuides (6)
  • In the Formatting code option, apply or paste the below-mentioned JSON formatting code. To Preview the code click on the Preview button.
  • Click on the Save button to save the changes.
{ "sections": [ { "displayname": "Tasks Assigned", "fields": [ "EmployessName", "TaskDescription", "AssignedTasks" ] }, { "displayname": "Tasks Period", "fields": [ "StartDate", "EndDate", "DueDate" ] }, { "displayname": "Tasks Status", "fields": [ "TrackTasksStatus", "TaskCompleted" ] } ]}

In the below screenshot, you can see the SharePoint Online list form is displaying the field in a section-wise manner.

SharePoint Online List Forms JSON Formatting - SPGuides (7)

We can also see that if we try to edit the columns in the form, the fields are displaying the section-wise manner as shown below:

SharePoint Online List Forms JSON Formatting - SPGuides (8)

This is how to customize or format the SharePoint Online list form body using JSON formatting.

Read Customize SharePoint List Forms with PowerApps

Customize the SharePoint Online List Form Footer using JSON formatting

Let us see how to customize or format the SharePoint Online list form footer using JSON formatting.

To achieve this, follow the below steps:

  • Open the SharePoint Online list form that you want to customize or format using JSON formatting.
  • Add a + New item to display the SharePoint Online list fields in a detailed view.
  • In the New item window, Expand the Edit form icon and click on the Configure Layout option as displayed below:
SharePoint Online List Forms JSON Formatting - SPGuides (9)
  • Once the configure layout option is selected, In the Apply formatting to option select the Footer option from the dropdown.
SharePoint Online List Forms JSON Formatting - SPGuides (10)
  • In the Formatting code option, apply or paste the below-mentioned JSON formatting code. To Preview the code click on the Preview button.
  • Click on the Save button to save the changes.
{ "elmType": "div", "style": { "height": "24px", "width": "100%", "color": "#fff", "font-size": "15px", "border-top": "5px solid #eee", "background-color": "Purple", "padding": "10px" }, "children": [ { "elmType": "div", "style": { "width": "100%", "padding-top": "10px", "height": "24px" }, "children": [ { "elmType": "a", "txtContent": "='Task Review for ' + [$Title]", "attributes": { "target": "_blank", "href": "='https://aka.ms/task?review=' + [$Tasks]" }, "style": { "color": "white" } } ] } ]}

In the below screenshot, you can see that the Footer is added to the SharePoint Online list form.

(Video) How to change column order in SharePoint List (Modern & Classic) | Hide columns in list forms

SharePoint Online List Forms JSON Formatting - SPGuides (11)

This is how to customize or format the SharePoint Online list form footer using JSON formatting.

Read Create a canvas app in PowerApps from a SharePoint list

SharePoint Online List Column JSON formatting examples

Let us see a few examples of Column formatting by using JSON formatting, we can apply column formatting for a title column, choice column, and person column in the SharePoint Online list.

Follow the below headings which is an example of SharePoint Online Column JSON Formatting based on the column data types.

SharePoint column JSON formatting to a Title Column

Let us see how we can use JSON column formatting to customize or format the Title column in the SharePoint Online list,

To Format a Title type Column by JSON formatting, follow the below steps:

  • Open the SharePoint Online list, and expand the Title column that you want to format or color code. Then select the Column settings and click on the Format this column option as shown below:

In this example, I have selected the Title column, to color code or format the column.

SharePoint Online List Forms JSON Formatting - SPGuides (12)
  • In the Format columns properties pane, Select or choose Advanced mode as shown below:
SharePoint Online List Forms JSON Formatting - SPGuides (13)
  • In the Formatting code option, apply or paste the below-mentioned JSON formatting code. To Preview the code click on the Preview button.
  • Click on the Save button to save the changes.
  • BySwitching to design mode, we can reset the list items to display in a default mode.
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "style": { "color": "Purple"}, "elmType": "div", "txtContent": "@currentField"}

In the below screenshot, you can see that the Title column has been color-coded with the Purple color.

SharePoint Online List Forms JSON Formatting - SPGuides (14)

This is how we can use JSON column formatting to customize or format the Title column in the SharePoint Online list.

Add JSON formatting to a Person column in a SharePoint Online list

Let us see how we can use JSON column formatting to customize or format the Person column in the SharePoint Online list,

To Format a Person type Column by JSON formatting, follow the below steps:

(Video) Display SharePoint list data using DetailsList Control in SPFx Web Part

  • Open the SharePoint Online list, and expand the Person column that you want to format or color code. Then select the Column settings and click on the Format this column option.
  • In the Format columns properties pane, Select or choose Advanced mode as shown below:

In this example, I have selected the EmployeesName column, which is of type person column to color code or format the SharePoint Online list items.

SharePoint Online List Forms JSON Formatting - SPGuides (15)
  • In the Formatting code option, apply or paste the below-mentioned JSON formatting code. To Preview the code click on the Preview button.
  • Click on the Save button to save the changes.
  • BySwitching to design mode, we can reset the list items to display in a default mode.
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "children": [ { "elmType": "span", "style": { "padding-right": "8px" }, "txtContent": "@currentField.title" }, { "elmType": "a", "attributes": { "iconName": "People"} } ]}

In the below screenshot, you can see that the EmployeesName column has been formatted with the people icon.

SharePoint Online List Forms JSON Formatting - SPGuides (16)

This is how we can use JSON column formatting to customize or format the People Column in the SharePoint Online list.

Add JSON formatting to a Date column in a SharePoint Online list

Let us see how we can use JSON column formatting to customize or format the Date column in the SharePoint Online list,

To Format a Date type Column by JSON formatting, follow the below steps:

  • Open the SharePoint Online list, and expand the Date column that you want to format or color code. Then select the Column settings and click on the Format this column option.
  • In the Format columns properties pane, Select or choose Advanced mode as shown below:

In this example, I have selected the JoiningDate column, which is of type date column to color code or format the SharePoint Online list items. The Joining Date will be color-coded if it is the same or before the current date.

SharePoint Online List Forms JSON Formatting - SPGuides (17)
  • In the Formatting code option, apply or paste the below-mentioned JSON formatting code. To Preview the code click on the Preview button.
  • Click on the Save button to save the changes.
  • BySwitching to design mode, we can reset the list items to display in a default mode.
{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "debugMode": true, "txtContent": "@currentField", "style": { "color": "=if([$JoiningDate] <= @now, '#FF33CA', '')" }}

In the below screenshot, you can see that the Joining Date column has been formatted based on the condition applied.

SharePoint Online List Forms JSON Formatting - SPGuides (18)

This is how we can use JSON column formatting to customize or format the Date column in the SharePoint Online list.

Add JSON formatting to a Choice column in a SharePoint Online list

Let us see how we can use JSON column formatting to customize or format the Choice column in the SharePoint Online list,

To Format a Choice type Column by JSON formatting, follow the below steps:

(Video) Create list in sharepoint online using rest api | Delete list in SharePoint Online using Rest API

  • Open the SharePoint Online list, and expand the Choice column that you want to format or color code. Then select the Column settings and click on the Format this column option.
  • In the Format columns properties pane, Select or choose Advanced mode as shown below:

In this example, I have selected the Department column, which is of type choice column to color code or format the SharePoint Online list items. The Departement Column will be color-coded based on the condition.

SharePoint Online List Forms JSON Formatting - SPGuides (19)
  • In the Formatting code option, apply or paste the below-mentioned JSON formatting code. To Preview the code click on the Preview button.
  • Click on the Save button to save the changes.
  • BySwitching to design mode, we can reset the list items to display in a default mode.

In this example, we apply the CSS classes likesp-field-severity–good,sp-field-severity–warning,sp-field-severity–Severewarningforthe Departments like FinanceTeam, Python Team and SharePoint Team respectively.

{ "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "elmType": "div", "attributes": { "class": "=if(@currentField == 'FinanceTeam', 'sp-field-severity--good', if(@currentField == 'Python Team', 'sp-field-severity--warning', if(@currentField == 'SharePoint Team', 'sp-field-severity--severeWarning','sp-field-severity--blocked'))) + ' ms-fontColor-neutralSecondary'" }, "children": [ { "elmType": "span", "style": { "display": "inline-block", "padding": "0 4px" }}, { "elmType": "span", "txtContent": "@currentField" } ]}

In the below screenshot, you can see that the Department column has been formatted based on the condition applied.

SharePoint Online List Forms JSON Formatting - SPGuides (20)

This is how to use JSON column formatting to customize or format the Choice column in the SharePoint Online list.

In this SharePoint Online customization tutorial, we learned how to customize and format the SharePoint Online list form using JSON with examples.

  • SharePoint Online List Forms JSON Formatting
  • Customize the SharePoint Online List Form Header using JSON formatting
  • Customize the SharePoint Online List Form Body using JSON formatting
  • Customize the SharePoint Online List Form Footer using JSON formatting
  • SharePoint Online List forms JSON Formatting examples
  • SharePoint list forms JSON examples
  • Customize modern SharePoint Online list forms JSON
  • SharePoint Online List Column JSON formatting examples
  • SharePoint column JSON formatting to a Title Column
  • Add column JSON formatting to a Person column in a SharePoint Online list
  • Add column JSON formatting to a Date column in a SharePoint Online list
  • Add column JSON formatting to a Choice column in a SharePoint Online list

You may like the following SharePoint tutorials:

  • SharePoint list view threshold
  • SharePoint list title column
  • How to display SharePoint list data in an HTML table using JavaScript
  • SharePoint Create Folder in List or Document Library
  • Create SharePoint list from excel

SharePoint Online List Forms JSON Formatting - SPGuides (21)

Bijay Kumar

I am Bijay a Microsoft MVP (8 times –My MVP Profile) in SharePoint and have more than 15 years of expertise in SharePoint Online Office 365, SharePoint subscription edition, and SharePoint 2019/2016/2013. Currently working in my own venture TSInfo Technologies a SharePoint development, consulting, and training company. I also run the popular SharePoint website EnjoySharePoint.com

(Video) SharePoint Online: Steps to Create List using JavaScript Object Model (jsom)

Videos

1. SharePoint rest api crud operations | CRUD operation in SharePoint Online using rest api
(EnjoySharePoint)
2. Add comments to SharePoint Online Or Microsoft Lists Items (Modern SharePoint List New Feature)
(EnjoySharePoint)
3. SharePoint alerts - Create alerts in SharePoint list or library
(EnjoySharePoint)
4. How to create a list from an existing list in SharePoint Online
(EnjoySharePoint)
5. How to use SharePoint Online List and List Properties in Web Part
(TSInfo Technologies)
6. Add an Index to Column in SharePoint Online/2013/2016 List or Document Library
(EnjoySharePoint)
Top Articles
Latest Posts
Article information

Author: Kimberely Baumbach CPA

Last Updated: 04/19/2023

Views: 5746

Rating: 4 / 5 (61 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Kimberely Baumbach CPA

Birthday: 1996-01-14

Address: 8381 Boyce Course, Imeldachester, ND 74681

Phone: +3571286597580

Job: Product Banking Analyst

Hobby: Cosplaying, Inline skating, Amateur radio, Baton twirling, Mountaineering, Flying, Archery

Introduction: My name is Kimberely Baumbach CPA, I am a gorgeous, bright, charming, encouraging, zealous, lively, good person who loves writing and wants to share my knowledge and understanding with you.