How to Format SharePoint IDs with Leading Zeros Using JSON
Question details
The user needs to format a SharePoint text column using JSON to display item IDs with a specific number of leading zeros, for example, REQ000001.

- Product
- SharePoint Online
- Device & OS
- not provided
- Scenario
- Customizing list views in SharePoint to display uniformly formatted ID numbers for easier tracking and professional presentation.
- Observed behavior
- The SharePoint list successfully displays item IDs uniformly formatted with a specific text prefix and exactly five leading zeros.
Ensure you have the appropriate site member or owner permissions to access 'Column settings' and modify column formatting in your SharePoint list.
Apply JSON Column Formatting for Leading Zeros
Use SharePoint's built-in advanced column formatting feature to manipulate the ID string and add leading zeros.
SharePoint allows you to customize the display of list data using JSON. By padding the ID number with zeros and concatenating it with a text prefix, you can achieve the REQ000001 format without altering the underlying data.
Navigate to your SharePoint list, click on the column header you wish to format, select 'Column settings', and then choose 'Format this column'.
At the bottom of the formatting pane on the right side of your screen, click on 'Advanced mode' to input a custom JSON script.
Enter the appropriate JSON code snippet that pads the ID with zeros. You will typically use string manipulation functions like `padStart` or manual concatenation depending on your SharePoint version.
Click the 'Save' button at the bottom of the pane to instantly apply the new formatting to your list view.
Consult Microsoft Developer Q&A for Complex Scenarios
If your JSON formatting requires advanced logical conditions or isn't working as expected, consult the official Microsoft SharePoint developer community.
Looking for a Seamless Office Suite? Try WPS Office
While SharePoint handles complex list structures and enterprise databases, everyday document processing is best done in a lightweight, robust environment. WPS Office offers a highly compatible alternative to Microsoft Office, supporting all major document formats with a familiar user interface.
- 1. Download the Installer: Visit the official WPS website and click the 'Download' button to get the free installation package.
- 2. Install WPS Office: Run the downloaded executable file and follow the on-screen prompts to complete the installation.
- 3. Open Your Office Files: Launch WPS Office and immediately open your existing Microsoft Office documents, spreadsheets, and presentations with perfect format retention.

Frequently Asked Questions
Can I use calculated columns instead of JSON for leading zeros in SharePoint?
Yes, you can use a calculated column with an Excel-like formula such as `="REQ"&TEXT([ID],"000000")`. However, relying on the [ID] field directly in calculated columns is officially unsupported by Microsoft and can cause the field to appear blank when a new item is first created.
Why is the ID field blank in my newly created SharePoint list item?
The item ID is generated by the SharePoint database only after the item is saved. If you are using a calculated column that relies on the ID, it may not populate immediately upon item creation until the page is refreshed or the item is edited.
Does WPS Office support editing documents stored in SharePoint?
Yes, you can easily open, edit, and save documents hosted on SharePoint using WPS Office. By syncing your SharePoint document library to your local machine via OneDrive, WPS Office can process the files with full format compatibility.




