About column formatting
Microsoft introduced SharePoint Column Formatting within SharePoint Lists and Libraries for SharePoint Online.
So, I was delighted to see that Microsoft have introduced a way to add SharePoint column formatting within the browser for #SharePointlist and #libraries. You can pretty much see your column values displayed in any way you want to, without hacking away in SharePoint Designer. But is it easy to accomplish as a Citizen Developer?
Here We have the document library which have 4 folders and accordingly add a value in number field.
Follow the below steps to open the area to add custom Json to format the field in Modern SharePoint Document Library or List.
How to create a Json string to format field?
1. Download Visual Studio Code. It’s free and fast to download.
2. In Visual Studio Code, create a new file, and save the empty file with a .json file extension.
3. Paste the following lines of code into your empty file.
You now have validation and autocomplete to create your JSON. You can start adding your JSON after the first line that defines the schema location.
At any point, select Ctrl+Space to have Visual Studio Code offer suggestions for properties and values. For more information, see Editing JSON with Visual Studio Code.
3. Add below json text in Json Area
It defines if Current Field Value is less than 2 the field color will be red and value is greater than 2 then field color will be green
Field looks as below
I will come soon with more details of Json string.
Happy Coding 🙂