Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Help me fix my JSON in Microsoft Lists

Like (0) ShareShare
ReportReport
Posted on 31 May 2023 08:12:35 by 97

Dear Experts,

In my microsoft lists , i really want to format view and also using Json to hide command bar like image as bellow:

CongDuong_0-1685520217425.png

 

1. JSON using to hide Command bar :

 

CongDuong_1-1685520278507.png

2. JSON using format view

CongDuong_2-1685520314167.png

 

This is JSON by text :

 

1. JSON hide commanf bar

{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
"commandBarProps": {
"commands": [
{
"key": "automate",
"hide": true
},
{
"key": "export",
"hide": true
},
{
"key": "share",
"hide": true
},
{
"key": "integrate",
"hide": true
}
]
}
}

 

2. JSON format view

{
"$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
"additionalEventClass": {
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Leave_x0020_type]",
"Annual leave"
]
},
"=if(@isSelected == true, 'sp-css-color-WhiteFont sp-css-backgroundColor-BgGreen' , 'sp-css-backgroundColor-BgMintGreen sp-css-color-MintGreenFont')",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Leave_x0020_type]",
"Other Leave"
]

},
"=if(@isSelected == true, 'sp-css-color-WhiteFont sp-css-backgroundColor-BgOrange' , 'sp-css-backgroundColor-BgPeach sp-css-color-PeachFont')",
{
"operator": ":",
"operands": [
{
"operator": "==",
"operands": [
"[$Leave_x0020_type]",
"Business Trip"
]
},
"=if(@isSelected == true, 'sp-css-color-WhiteFont sp-css-backgroundColor-BgTeal' , 'sp-css-backgroundColor-BgCyan sp-css-color-CyanFont')+' sp-field-fontSizeSmall'",
""
]
}
]
}
]
}
}

 

 

What i need to do is combined both into one JSON to format view and hide command bar as well.

Cause i don't have knowledge about coding 🙂

Please help me, thanks you all !

  • JMSmith Profile Picture
    3 on 06 Feb 2024 at 15:00:52
    Re: Help me fix my JSON in Microsoft Lists

    @CongDuong I run into these small-but-impactful issues sometimes when editing directly in the browser myself. When they happen, I copy and paste the view formatting into a code editor (VS Code in my case), which shows syntax errors where they occur rather than SharePoint's vague Please enter valid view-formatting JSON message. Here's a missing comma, for instance:

    JMSmith_0-1707231305762.png

     

    While you're at it, I see you're using the default SP interface, so I would also recommend this lovely Chrome/Edge extension:

    https://github.com/pnp/sp-formatter

     

    It doesn't highlight inline errors like VS Code, but it does update the formatting preview in real time, which can help identify trouble spots.

  • CongDuong Profile Picture
    97 on 31 May 2023 at 08:48:07
    Re: Help me fix my JSON in Microsoft Lists

    Dear @Expiscornovus ,

     

    Thank you for helping soon,

    I try to using your JSON, Unbelievable !!!!! It's working very well.

     

    CongDuong_0-1685522872592.png

     

    One again , thank you so much !

  • Verified answer
    Expiscornovus Profile Picture
    31,652 Most Valuable Professional on 31 May 2023 at 08:37:44
    Re: Help me fix my JSON in Microsoft Lists

    Hi @CongDuong,

     

    This question is related to SharePoint Online list and column formatting, not really a Power Automate type of question.

     

    That being said, I think you need to remove the closing curly bracket just before the additionalEventClass and add one missing comma character.

     

    Try the json below:

     

    {
    "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/row-formatting.schema.json",
    "commandBarProps": {
    "commands": [
    {
    "key": "automate",
    "hide": true
    },
    {
    "key": "export",
    "hide": true
    },
    {
    "key": "share",
    "hide": true
    },
    {
    "key": "integrate",
    "hide": true
    }
    ]
    },
    "additionalEventClass": {
    "operator": ":",
    "operands": [
    {
    "operator": "==",
    "operands": [
    "[$Leave_x0020_type]",
    "Annual leave"
    ]
    },
    "=if(@isSelected == true, 'sp-css-color-WhiteFont sp-css-backgroundColor-BgGreen' , 'sp-css-backgroundColor-BgMintGreen sp-css-color-MintGreenFont')",
    {
    "operator": ":",
    "operands": [
    {
    "operator": "==",
    "operands": [
    "[$Leave_x0020_type]",
    "Other Leave"
    ]
    
    },
    "=if(@isSelected == true, 'sp-css-color-WhiteFont sp-css-backgroundColor-BgOrange' , 'sp-css-backgroundColor-BgPeach sp-css-color-PeachFont')",
    {
    "operator": ":",
    "operands": [
    {
    "operator": "==",
    "operands": [
    "[$Leave_x0020_type]",
    "Business Trip"
    ]
    },
    "=if(@isSelected == true, 'sp-css-color-WhiteFont sp-css-backgroundColor-BgTeal' , 'sp-css-backgroundColor-BgCyan sp-css-color-CyanFont')+' sp-field-fontSizeSmall'",
    ""
    ]
    }
    ]
    }
    ]
    }
    }

     

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Congratulations to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,786 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,093 Most Valuable Professional

Leaderboard