cancel
Showing results for 
Search instead for 
Did you mean: 

JSON response without []

mongley
New Contributor II

Hello,

I need to construct a JSON response to validate a webhook for Adobe Sign.

The required response is { "xAdobeSignClientId": "BGBQIIE7H253K6" }

However by default I get [{ "xAdobeSignClientId": "BGBQIIE7H253K6" }] which is rejected.

Is there a way to remove the square brackets from the response?

Many thanks,
Mark

 

1 ACCEPTED SOLUTION

@mongley 

One way is to add JSON Formatter Snap after the Mapper Snap, with "Format each document" checked.

Spiro_Taleski_0-1695899801358.png

BR,

Spiro Taleski

View solution in original post

4 REPLIES 4

koryknick
Employee
Employee

@mongley - I'm not sure how you created the document to send, but since the displayed document is an array, you could either follow the reference with [0] to get the first value in the array, or .pop() to get the last element. 

mongley
New Contributor II

Thanks for having a look. I am simply assigning a string to the variable $xAdobeSignClientId in a mapper as per screenshot. If I take the variable in a subsequent mapper and use [0] this return the first character of the string, using pop() errors with the message 'String type does not have a method named: pop' so within SnapLogic this is not an array. When I call the triggered task from a browser or Postman it is returned within an array - which is therefore rejected by Adobe.

mongley_0-1695891699706.png

 

@mongley 

One way is to add JSON Formatter Snap after the Mapper Snap, with "Format each document" checked.

Spiro_Taleski_0-1695899801358.png

BR,

Spiro Taleski

Many thanks, that worked perfectly.