04-18-2022 03:11 AM
I have 2 different arrays, one having id, header and another having id,name.
Need to join these 2 arrays and get an output file of id,header,name.
I need json splitter json path, I have just for id which is jsonPath($, “id[*]”).
How do I include both id and header.
File.txt (4.2 KB)
Solved! Go to Solution.
04-20-2022 03:03 AM
try different mapping, change the ‘$’ to something else
04-19-2022 10:57 PM
Hi @bojanvelevski , have a look at it please.
04-20-2022 12:27 AM
Join 2 arrays_2022_04_20.slp (20.9 KB)
The following updates were made:
• Filter is added after splitting the products. There are products without any “ObjectGroups” path that need to be filtered.
• Expression for getting the “Name” is changed in Mapper2 to more accurate one that gets exactly the field we need.
04-20-2022 01:40 AM
Hi, Could you please try to run this file,
file2.txt (4.9 KB)
seeing:
Failure: Json Splitter expects a list, Reason: Found an object of type class java.util.LinkedHashMap, Resolution: The path $.ObjectRef needs to refer to a list in the incoming document
04-20-2022 01:45 AM
In lower branch Mapper3, change the expression to:
sl.ensureArray($OtherData.ObjectGroups.ObjectGroup.ObjectRef)
This happens because in one document, there’s only one object, so you need to make sure that you add that one in an array.
04-20-2022 02:17 AM
Hi, Thanks it solved the problem. Although when i am trying to use CSV Formatter after join getting error:-
Failure: Index -1 out of bounds for length 0, Reason: Snap failed unexpectedly and did not provide any reason
I am mapping like below:-
$Name
$[‘$’]