Skip to main content

Notifications

Power Automate - General Discussion
Suggested answer

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

(1) ShareShare
ReportReport
Posted on by 193
Hi Experts,
 
I am trying to rename a file in the sharepoint folder post extraction actions.
Below the flow which is using for this task:
 
 
File location :
 
 
I am trying to renaming the above file into "Risk Findings.xlsx" , after the flow runs it got the below error message and failed.
 
{
  "status"400,
  "message""Invalid JSON. A comma character ',' was expected in scope 'Object'. Every two elements in an array and properties of an object must be separated by commas.\r\nclientRequestId: 4180f1cc-0d73-44ce-ba39-66427c218398\r\nserviceRequestId: 2acc57a1-a00f-a000-0590-e99dc93dca30",
  "source""https://xxxxx.sharepoint.com/sites/yyyy122/_api/lists/GetByTitle('Documents')/Items(61)",
  "errors": [
    "-1",
    "Microsoft.SharePoint.Client.InvalidClientQueryException"
  ]}
 
Please help to solve this ..
 
Thanks
DK
 
Categories:
  • Suggested answer
    DineshK_ Profile Picture
    DineshK_ 193 on at
    Invalid JSON. A comma character ',' was expected in scope 'Object'
    This flow will run every week to generate this file , so to avoid duplications i have added utcnow in the file name.
    Now i sorted this issue by adding delay action before the rename .
    works well :) Thanks you ..
  • Expiscornovus Profile Picture
    Expiscornovus 31,144 on at
    Invalid JSON. A comma character ',' was expected in scope 'Object'
    That is because earlier in the flow you were still interacting with the Excel file via the add a new row action, which will lock it/consider the file still in use.
     
    You can handle this behaviour in several ways. In your case why don't you rename the file before you are adding the rows to the table? Or do you have a specific reason to rename it at the end?
     
    Alternatively, have a look at this article from Matthew Devaney with 4 other approaches:
  • Suggested answer
    DineshK_ Profile Picture
    DineshK_ 193 on at
    Invalid JSON. A comma character ',' was expected in scope 'Object'
     
    I have used the below body content and after that old error is gone and getting new error as below :
     
     
    File is not opened anywhere , the flow will generate this file (so every run the file will be NEW only) and then renaming it by using HTTP action . You can see full flow in the post.
    How to overcome this error ?
     
    {'__metadata':
    {'type':'SP.Data.Shared_x0020_DocumentsItem'},
    'FileLeafRef':'<New filename>'
    }
     
     
  • Suggested answer
    Expiscornovus Profile Picture
    Expiscornovus 31,144 on at
    Invalid JSON. A comma character ',' was expected in scope 'Object'
    I see you used the Body of the first HTTP request in the type field value of the second request. It probably is confused about that because the first request returns all properties of a list item instead of just a single property value of the library/list itself.

    If you want to get the type value of your list/library you can use the ListItemEntityTypeFullName. I have also shared a blog about how to retrieve this type value:
     
    I would suggest to change the URI of the Send an HTTP request to SharePoint to get type action to be below:
    _api/web/lists/GetByTitle('Documents')/?$select=ListItemEntityTypeFullName
     
    In the Send an HTTP request to SharePoint to rename file action use the below json in the body field instead:
    {"__metadata":
    {"type":"@{outputs('Send_an_HTTP_request_to_SharePoint_to_get_type')?['body']?['d']?['ListItemEntityTypeFullName']}"},
    "FileLeafRef":"Risk Findings.xlsx"}
     
     
  • Suggested answer
    abc 123 Profile Picture
    abc 123 724 on at
    Invalid JSON. A comma character ',' was expected in scope 'Object'
    I'm guessing that the greater than and less than symbols are invalid, but maybe you just altered that to hide personal data.
     
    Check this out:

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,666

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,996

Leaderboard