Forum Discussion

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

How can i get the input data sent to JSON parser snap.

Hi, I have JSON parser snap in my pipeline and it is getting data from external resources.
Sometimes the data parse is failing due to invalid input. But am not able to capture that input data and error shows only "Invalid Json error" message (as below).

"error": "Cannot parse JSON data",
"reason": "Unable to parse JSON input, Invalid UTF - 8 middle byte 0x20"

Can somebody help me, how to capture the input data getting into Json parser snap.

Thank You.

 

 
  • Hello manjunathsinghs,

    I'd suggest using the Binary Copy Snap as your starting point. Then create two copy branches: one for storing the payload through the File Writer Snap, and the other for your downstream logic.

    Try this and let me know if this helps you.

    Regards,

    Aleksandar.

7 Replies

  • Hello manjunathsinghs,

    I'd suggest using the Binary Copy Snap as your starting point. Then create two copy branches: one for storing the payload through the File Writer Snap, and the other for your downstream logic.

    Try this and let me know if this helps you.

    Regards,

    Aleksandar.

  • SpiroTaleski's avatar
    SpiroTaleski
    Valued Contributor

    manjunathsinghs 

    The JSON parser snap will not keep/forward the incoming "invalid" data on a Snap Error view.  So, probably you will need to re-design the whole pipeline. 

    Typically, this kind of issues should be resolved/handled on the source system that actually is sending the "invalid" data to SnapLogic endpoint.   

    • manjunathsinghs's avatar
      manjunathsinghs
      New Contributor II

      Hi,

      Thanks for reply.
      Json Parser snap is the first snap in my pipeline and when the input request is valid and able to parse it and then i can able to capture it using Mapper snap (above screenshot for ref.).
      But, if the input request is not valid and failed at parser snap. then i donno how to capture that input data.
      So, Not sure how File Writer snap can help to capture the input request from parser snap? Can you please explain where i should use it in the flow.
      Thanks.

  • manjunathsinghs's avatar
    manjunathsinghs
    New Contributor II

    Thank You, SpiroTaleski , Aleksandar_A .
    With your suggestion, am able to capture all the input data coming to my pipeline.
    Is there any way i can capture only invalid input data, which fails at json parser?
    Thanks.