cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Pedrogr90
Frequent Visitor

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

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Pedrogr90
Frequent Visitor

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

 

 

View solution in original post

2 REPLIES 2
Pstork1
Dual Super User
Dual Super User

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.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.
Pedrogr90
Frequent Visitor

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

 

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Users online (1,588)