INVALID_JSON_ATTRIBUTE Error in powershell

Welcome Forums General PowerShell Q&A INVALID_JSON_ATTRIBUTE Error in powershell

Viewing 1 reply thread
  • Author
    Posts
    • #238655
      Participant
      Topics: 11
      Replies: 9
      Points: 110
      Rank: Participant

      Hi All

      I am trying to write a Hash table for the below JSON code in power shell script and getting INVALID_JSON_ATTRIBUTE error
      Here is the Error while executing powershell script. Can anyone please help me identify the error with hash table code
      Invoke-RestMethod : {“detail”:”Received JSON for the actions attribute does not match expected
      format.”,”error”:400,”errorCode”:”INVALID_JSON_ATTRIBUTE”,”parameters”:[“actions”],”reason”:”Bad Request”}
    • #238661
      Participant
      Topics: 0
      Replies: 37
      Points: 372
      Helping Hand
      Rank: Contributor

      Hello pk30,

      You need to add coma on line #11.

      You need to increase Depth parameter of ConvertTo-Json. Default value is 2 and it is too small for you nested objects structure.

      In your case it should be at least 4.

      Reference:

      https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/convertto-json?view=powershell-7

      Hope that helps.

       

      • This reply was modified 2 months, 3 weeks ago by AndySvints.
      • This reply was modified 2 months, 3 weeks ago by AndySvints.
Viewing 1 reply thread
  • You must be logged in to reply to this topic.