cancel
Showing results for 
Search instead for 
Did you mean: 

Parsing exception

shubhisharma
New Contributor

Hello All,

I am having XML as an input to my pipeline. I have to map the elements from the incoming request and form a new request. I am facing a casting exception stating “Failure: java.lang.String cannot be cast to java.util.Map, Reason: Snap failed unexpectedly and did not provide any reason”.

The catch is incoming XML is not able to recognize array.
Refer the screenshot.
CastingEXp

3 REPLIES 3

dmiller
Admin Admin
Admin

If you are certain the incoming XML is an array that’s being treated as an object, then it sounds like a bug that should be submitted through Support.


Diane Miller
Community Manager

I was somehow able to manage by using an extra mapper in my pipeline. I explicitly converted the object into Array.
I used:
$Object instanceof Array ? $Object : [$Object].

FYI, the sl.ensureArray() function will do the same as the code you posted, but is a little shorter and easier to remember.