Forum Discussion

Abhishek_Soni37's avatar
Abhishek_Soni37
Contributor
5 years ago

Final Mapper response is generating [] to it

Hi All,

I’m stuck with this small problem where I’m trying to send the response(received from Rest Post Snap) via mapper after extracting the required tags form the response but the final Mapper output is coming with hence the receiver system is not able to parse the message as it’s expecting the message in {}.
Expected response format :
{
“IsSuccess”:true,
“Error”:“”
}

Pipeline Response:
[ {
“IsSuccess”:true,
“Error”:“”
}]

Error at the receiver system:
{“Status”:2,“Error”:“Unable to parse JSON: [\n {"IsSuccess":true,"Error":""}\n]\n”}

Is there a way to avoid those before from the response generated by the Mapper?

Pipeline Details:
Main - Rest Post
Type - Triggered task pipeline

Thanks in advance.!

Cheers,
Abhishek

4 Replies

  • Hi @Soni37

    You should check what you have as inputs in your Gate. Note that you’ll always have input0 and input1. input0 is your Error output from the Post.
    Also, it depends on how you handled it in the Mapper.

    /Igor

    • Abhishek_Soni37's avatar
      Abhishek_Soni37
      Contributor

      Hi @igormicev,

      Thanks for your input.

      But based on the Gate output I’m extracting Whether the http code is 200/500 via mapper.
      Even when the Output doc contains only one tag-“http_code” final output is coming with square bracket.

      Please find below Snips of the mapper and response:

      Thanks,
      Abhishek Soni

      • del's avatar
        del
        Contributor III

        @Soni37,

        Per the referenced post below:
        Add to your existing pipeline a mapper, change its output to binary, and configure the Transformation section like this:

        Reference: