SharePoint List Form Formatting JSON

Formatting SharePoint list forms can significantly enhance user experience and improve data input accuracy. One powerful way to achieve this is by leveraging JSON (JavaScript Object Notation) to customize form fields, validation, and behavior. Let's delve into the world of SharePoint list form formatting with JSON.

SharePoint List JSON Form Formatting & Validations (3)
SharePoint List JSON Form Formatting & Validations (3)

SharePoint list forms are dynamic and versatile, allowing you to create intricate data structures tailored to your organization's needs. JSON plays a pivotal role in shaping these forms, enabling you to define complex field properties, set conditional rules, and even control form layout.

Learn How To Customize A Sharepoint List Form
Learn How To Customize A Sharepoint List Form

Understanding SharePoint JSON Formatting

SharePoint JSON formatting allows you to modify the appearance and behavior of list forms without writing any code. It uses a JSON schema to describe the desired form structure and properties. By understanding the JSON syntax and available properties, you can create sophisticated form experiences.

Customize SharePoint Forms with JSON
Customize SharePoint Forms with JSON

JSON formatting supports various data types, including strings, numbers, objects, arrays, booleans, and null. It also supports nesting, enabling you to create complex, hierarchical structures. This flexibility makes JSON an ideal choice for formatting SharePoint list forms.

JSON Syntax Basics

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

Before diving into SharePoint list form formatting, let's quickly review some JSON syntax basics:

  • Key-value pairs: JSON uses key-value pairs to store data. Keys are enclosed in quotation marks and followed by a colon, while values can be any data type.
  • Objects: Curly braces {} enclose objects, which are unordered collections of key-value pairs.
  • Arrays: Square brackets [] enclose arrays, which are ordered lists of values.
  • Strings: Strings are enclosed in quotation marks and can contain any sequence of characters.

SharePoint JSON Formatting Properties

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

SharePoint JSON formatting provides a rich set of properties to customize list forms. Some key properties include:

  • descriptor: Defines the field to format. It can be a column name, a managed property, or a calculated value.
  • displayName: Sets the display name of the field.
  • required: Specifies whether the field is required.
  • visible: Determines whether the field is visible.
  • readonly: Makes the field read-only.
  • choices: Defines a set of choices for a field, enabling picklists and dropdowns.

Formatting SharePoint List Forms with JSON

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

Now that we've covered the basics of JSON and its properties, let's explore how to format SharePoint list forms using JSON.

To apply JSON formatting to a SharePoint list form, follow these steps:

Customizing SharePoint List Forms in InfoPath 2010
Customizing SharePoint List Forms in InfoPath 2010
How to List Unique Permissions for Files and Folders on a SharePoint Site
How to List Unique Permissions for Files and Folders on a SharePoint Site
Create SharePoint Lists Faster Using Templates
Create SharePoint Lists Faster Using Templates
Connect SharePoint List To Excel - Part 2
Connect SharePoint List To Excel - Part 2
Learn How To Implement Sharepoint List Validation
Learn How To Implement Sharepoint List Validation
Why You Should Never Embed Document Libraries and Lists into SharePoint Pages
Why You Should Never Embed Document Libraries and Lists into SharePoint Pages
How to Create a Custom List in SharePoint | Beginner Tutorial
How to Create a Custom List in SharePoint | Beginner Tutorial
How to implement Document Management System in SharePoint using Content Types | SharePoint Maven
How to implement Document Management System in SharePoint using Content Types | SharePoint Maven
Editing a Form: InfoPath
Editing a Form: InfoPath
SharePoint Content Types - BoostSolutions
SharePoint Content Types - BoostSolutions
SharePoint Page Section Templates Explained
SharePoint Page Section Templates Explained
How to track documents in SharePoint using Document ID feature | SharePoint Maven
How to track documents in SharePoint using Document ID feature | SharePoint Maven
How to create sites and site collections from a SharePoint Site Template | SharePoint Maven
How to create sites and site collections from a SharePoint Site Template | SharePoint Maven
Client Challenge
Client Challenge
the shareholders agreement is shown in this document, which includes two separate sections and one section
the shareholders agreement is shown in this document, which includes two separate sections and one section
How to Personalize SharePoint for Users
How to Personalize SharePoint for Users
How to Do Branching in Forms
How to Do Branching in Forms
a poster with information about the different types of software
a poster with information about the different types of software
Why you should never attach documents in a SharePoint list | SharePoint Maven
Why you should never attach documents in a SharePoint list | SharePoint Maven
a blank sign up sheet with lines on it
a blank sign up sheet with lines on it
  1. Navigate to the list settings and click on "Form Settings".
  2. Under "Form Type", select "Customize form".
  3. Click on "Advanced Mode" to access the JSON editor.
  4. Enter your JSON formatting code in the editor.
  5. Click "OK" to save and apply the changes.

Formatting Fields

To format a field, use the descriptor property to specify the field name, then define the desired properties. Here's an example that formats the "Title" field:

```json { "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "additionalRowClass": "sp-field-severity--high", "descriptor": { "columnName": "Title" }, "displayName": "Project Title", "required": true, "visible": true, "readonly": false } ```

Creating Conditional Formatting

JSON formatting also enables conditional formatting, allowing you to change field properties based on specific conditions. The if and then properties are used to define these conditions. Here's an example that changes the background color of the "Status" field based on its value:

```json { "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json", "descriptor": { "columnName": "Status" }, "style": { "background-color": { "if": "[$Status] == 'Completed'", "then": "#D1FAE5", "elseIf": "[$Status] == 'In Progress'", "then": "#FFF59D" } } } ```

In conclusion, SharePoint list form formatting with JSON empowers you to create intuitive, user-friendly forms that enhance data input and organization. By mastering JSON syntax and SharePoint's JSON formatting properties, you can unlock the full potential of SharePoint list forms and tailor them to your organization's unique needs.

Embrace the power of JSON formatting and take your SharePoint list forms to the next level. Start exploring and experimenting with JSON today, and watch as your forms transform into dynamic, engaging experiences for your users.