cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Formatting Request Payload as an Array rather than a Hash

demontoya
Not applicable

I am trying to format a request payload to be an array of objects, but it appears that the payload HTTP method defaults to formatting it as a hash such as 

{
  email: "exampleemail",
  name: "John Jacob Jingleheimer Schmidt"
}

However, it needs to be enveloped in an array like as follows:

[
  {
    email: "exampleemail",
    name: "John Jacob Jingleheimer Schmidt"
  }
]

The payload HTTP method does not accept arrays, as this will throw an error. Is there a way to do this? What are your thoughts on this? 

1 REPLY 1

gary1
Executive Chef III
Executive Chef III

I just tested this and the HTTP request payload (specifically for a POST) will accept an array without issue. You may be encoding it incorrectly. Can you provide more details on the error you receive?