cancel
Showing results for 
Search instead for 
Did you mean: 

Final Mapper response is generating [] to it

Abhishek_Soni37
Contributor

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
OGM

Thanks in advance.!

Cheers,
Abhishek

4 REPLIES 4

igormicev
Contributor

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

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:
httpcode
SL

Thanks,
Abhishek Soni

@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:

image

Reference:

Thanks @del

It worked like a charm. 🙂

Thanks,
Abhishek