cancel
Showing results for 
Search instead for 
Did you mean: 

JSON snap not working as expected

dabalka
New Contributor II

JSON splitter last week was working correctly.
Pipeline was not edited, JSON format did not change, and yet Pipeline is crashing indicating error that JSON splitter is expecting list not an object. Before 17th of Feb it was working perfectly fine. was something changed in snap architecture?
“Failure: Json Splitter expects a list, Reason: Found an object of type class java.util.LinkedHashMap, Resolution: The path $.data needs to refer to a list in the incoming document”

image

1 ACCEPTED SOLUTION

The object $data is an instance of Object not an array…

Place a mapper before the JSON splitter then set mapper as pass through enabled

image

View solution in original post

16 REPLIES 16

ivicakoteski
New Contributor II

Hi Dabal,

JSON splitter is expecting list not an object, for example if the input is an object “data”: {“test1”:123}, JSON splitter will fallout because it is needed to be in array “data”: [{“test1”:123}]. You can use sl.ensureArray expression (Confluence) in Mapper snap before JSON splitter, to solve this issue.
Example: sl.ensureArray($data) - If it is an array will return unchanged, otherwise it should return the argument in an array.

Let me know if this helps you.

BR,
Ivica

but why it was working more than one year, it was still working on Thursday, and today it is not working?
In release notes I see that Snaplogic was making some changes in JSON Splitter Snap - can this be a reason? Coincidence ?

alchemiz
Contributor III

Is $.data[*] the correct path?

Try $data[*]

dabalka
New Contributor II

no difference, even if I use get