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