Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Answered

Invalid JSON. A comma character ',' was expected in scope 'Object' Error

(0) ShareShare
ReportReport
Posted on by 27

Hi people

 

I am trying to build a flow that creates a List with items

There is a column of type Choice , with a custom format defined in the Flow

 

I have a variable called "CustomFormatStatus" of type "String" defined like this:

 

{
 "$schema": "https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json",
 "elmType": "div",
 "attributes": {
 "class": "=if(@currentField == 'Approved', 'sp-field-severity--good', if(@currentField == 'Not Selected', 'sp-field-severity--warning', if(@currentField == 'Not Approved', 'sp-field-severity--blocked', 'sp-field-severity--blocked'))) + ' ms-fontColor-neutralSecondary'"
 },
 "children": [
 {
 "elmType": "span",
 "style": {
 "display": "inline-block",
 "padding": "0 4px"
 },
 "attributes": {
 "iconName": "=if(@currentField == 'Done', 'CheckMark', if(@currentField == 'In progress', 'Forward', if(@currentField == 'In review', 'Error', if(@currentField == 'Has issues', 'Warning', 'ErrorBadge'))))"
 }
 },
 {
 "elmType": "span",
 "txtContent": "@currentField"
 }
 ]
}

 

Then below I have inserted this JSON in the HTTP Request like this:

 

Pedrogr90_0-1611773412695.png

 

And then when i run the flow , i get the following error:

Pedrogr90_1-1611773541470.png

 

I have tested the JSON in a test list and the formatting is applied correctly when the value changes, so i cannot really figure out what the problem is here.

 

Thank you in advance.

  • Verified answer
    Pedrogr90 Profile Picture
    27 on at
    Re: Invalid JSON. A comma character ',' was expected in scope 'Object' Error

    Solution:

     

    Seems that if you have double quotes, then in order for the single quotes inside to be recognized as such, I had to put a \ just before the single quote

     

    Source : https://techcommunity.microsoft.com/t5/sharepoint/json-column-formatting-with-flow/m-p/1491794

     

     

  • Pstork1 Profile Picture
    66,015 Most Valuable Professional on at
    Re: Invalid JSON. A comma character ',' was expected in scope 'Object' Error

    I'm not sure that it matters, but I noticed that in some places you used double quotes and in others you used single quotes.  Flow tends to be fairly touchy about the use of double quotes in JSON.  Change FieldTypeKind and Choices to single quotes and try again.

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!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,670 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,015 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow