Forum Discussion

mongley's avatar
mongley
New Contributor II
2 years ago
Solved

JSON response without []

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

 

  • mongley 

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

    BR,

    Spiro Taleski

4 Replies

  • 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's avatar
      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.

       

      • SpiroTaleski's avatar
        SpiroTaleski
        Valued Contributor

        mongley 

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

        BR,

        Spiro Taleski