14
votes
Accepted
JSON Column formatting - Joining values
Yep, your alternative to an inline expression is this for concatenating values:
{
"elmType": "div",
"txtContent": {
"operator": "+",
"operands": [
"[$Duration]",
" ",
"[$...
6
votes
Accepted
What limitations should I keep in mind when choosing between single line of text or choice columns?
You are correct that you can't use a choice field in a lookup (but you can reference a choice field in a calculated column which can be used in lookups). However, there are some gotchas when it comes ...
5
votes
How to add a link to list item in a JSON view format?
You could use $ID.
Sample demo:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType": "a",
"txtContent": "@currentField",
"attributes": {
...
5
votes
what can you do with Format View
Adding to what Lukas has mentioned .
Long story short, just look at the snip below (Taken from the Microsoft official description) for complete view of what Formatting can do.
5
votes
Accepted
Lists: Circle progress bar as column view
Yes, it is possible using JSON column formatting capabilities.
Check this sample available in GitHub list formatting samples repository:
Doughnut Chart
Additional formatting samples:
Number Battery
...
5
votes
Format view using @group.fieldData on a lookup column
Try using below JSON code:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
"groupProps": {
"hideFooter&...
5
votes
Custom view rowformatter - how to make a hyperlink look like a button
Use JSON like below to create hyperlink with button:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "...
4
votes
Accepted
How to utilize if/else condition for JSON column formatting in SharePoint?
You can do it similar to that in Excel :)
You can checkout the below sample to get an idea:
"background-color": "= if([$OtherColumn] == 'Red', 'red',
if([$OtherColumn] == 'Green', 'green',
if([$...
4
votes
How to add a link to list item in a JSON view format?
There is another option that is to just use the defaultClick action:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/column-formatting.schema.json",
"elmType&...
4
votes
Accepted
In a Sharepoint List: Display an Image (field type "Hyperlink or Picture")
You almost got it. Set src attribute directly. src is just URL to an image, so why to use description at all. If you look at the rendered HTML code using Developer dashboard (F12) you will find that ...
4
votes
Accepted
what can you do with Format View
Improve the display of views in SharePoint lists with formatting. The view-formatting text describes the elements that are displayed and their display style. The data in the list doesn't change.
In ...
4
votes
Accepted
How to display Persona Card on hover in list using Sharepoint Online view formatting?
Use the defaultHoverField property in JSON as described here:
Use column formatting to customize SharePoint
4
votes
Accepted
Can we render element based on the current field value in Column Formatting?
Try using below JSON:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"style":...
4
votes
Accepted
SharePoint Online list - format group headers to remove column name
Use below JSON to format list view:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
"groupProps": {
"...
4
votes
Accepted
How can I show JSON formatting only for one content type and keep the default for all others?
Use JSON code similar to this:
{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
"elmType": "div",
"...
4
votes
Accepted
How to hide buttons on the item context menu in SharePoint 365 Modern Experience
First of all, you cannot hide individual context menu options using JSON formatting. You can only customize/hide options from command bar at the top.
You can hide "Share" option from command ...
4
votes
Accepted
How can I add a link to list attachments using Json formatting
Unfortunately, the attachments field is not directly accessible in JSON formatting.
You can only check if attachments are available or not for the list item using:
"txtContent": "=if([$...
3
votes
Column formatting - AND OR conditions
You've basically got the "Or" idea down. You only need to switch it to "And," except without using &&'s or ||'s. Here's what I mean:
I'm going to split this out onto multiple lines so it's ...
3
votes
How to color code a SharePoint list date field based on comparison with todays date?
For Modern UI:
Yes, you can use json formatting to conditionally color fields in sharepoint online.
The following example colors the current date field red when the value inside an item's ...
3
votes
what can you do with Format View
Using format view, you can format rendering of your library view. As in Previous version of SharePoint/Classic experience SharePoint developers are using Client side rendering(CSR) option to customize ...
3
votes
Accepted
Display HTML formatted text from Rich Text multi-line column in SharePoint list column formatted with JSON
Currently, rich multiline text fields are not supported within json column formatting. You could read this article: https://github.com/SharePoint/sp-dev-list-formatting/issues/88
The only workaround ...
3
votes
Accepted
JSON conditional format column based on choice from another column
If the source column allows multiple value selections, SharePoint stores those selections as an array of values inside the field. Therefore, matching on a single string value will never succeed ...
3
votes
Accepted
If statement JSON column formatting - SharePoint Online List
I looks to me like you want the text to be #168DC8 and the background to be white unless the lookupValue is not one of the defined conditions, then you'd like them swapped. Try this format:
{
"$...
3
votes
Accepted
Need Help with "Format View" feature in Modern List based on Condition
To do the comparison against the current date, you need to use the @now. Also, you need to calculate a date 5 days back from today. So, you need to subtract 5 days worth of milliseconds, (5 * 24 * 60 *...
3
votes
Accepted
Adding custom hover text using json to a SharePoint list column
You can try this and customize to suit your need
{
"elmType": "div",
"style": {
"font-size": "12px"
},
"txtContent": "@...
3
votes
Accepted
Change column name in view using json view formatting
If you want to change the column header and keep the list view as a standard SharePoint list view then No.
It is not possible to just change the column headers using JSON formatting.
If you want to ...
3
votes
Accepted
Using JSON to change the color of a row based on the date it was Modified
Use below JSON in Format current view:
{
"schema": "https://developer.microsoft.com/json-schemas/sp/view-formatting.schema.json",
"additionalRowClass": "=if([$...
3
votes
Accepted
Using Json to format a row in a sharepoint list
Try using this:
"additionalRowClass": "=if([$Deleted] == 'Deleted', 'sp-field-strikeThrough sp-css-color-red', if([$Modified] < @now && [$Modified] >= @now - 86400000, 'ms-...
3
votes
Using json to modify lots of different columns in a SharePoint list
There is no way to apply JSON formatting to multiple columns at a time using SharePoint out of the box capabilities.
So, you need to use PowerShell and automate this process to apply JSON formatting ...
3
votes
Accepted
How to detect Edit vs New when styling custom list forms with JSON?
Using Created, ID, or Author in JSON code will not work as those fields are not shown on list forms.
You can refer only those columns which are shown on list forms.
Also, even if you refer any other ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
json-formatting × 755sharepoint-online × 675
modern-experience × 442
list × 380
column-formatting × 309
view-formatting × 110
json × 69
list-view × 68
list-form × 54
document-library × 45
lookup-column × 22
power-automate × 21
flow × 19
calculated-column × 18
sharepoint-server × 14
conditional × 13
column × 12
microsoft-lists × 12
person-or-group × 11
2019 × 10
date-time × 9
formatting × 9
web-part × 8
calculated-column-formula × 8
hyperlink × 8