Forum Discussion
Hi jfpelletier ,
I did the below to get the UIDs in an array, maybe you fine-tune it a bit more to reduce the snaps:
Input:
[
{"UID":"UID1"},
{"UID":"UID2"},
{"UID":"UID3"},
{"UID":"UID4"}
]
I used a mapper snap after this and since we want to get all documents in a single array, I added the below expression to extend the UID doc with a common value that I can use later in group by fields snap to group all the records.
$.extend({"group":"1"})
The output of this mapper looks like this:
Later I added a group by fields snap and grouped the input based on the group tag:
The output will be an array of all documents where the group has same value, in our case it'll be the same for all records of UIDs.
Added another mapper with the below expression:
jsonPath($, "group[*].UID")
The final o/p looks like this:
Hope this helps.
Cheers,
Abhishek
Hello Abhishek_Soni37,
Thanks a lot for your help, it resolved my problem the way I wanted. This is something I will probably re-use a lot, super useful for me! 🙂
Kind regards,
JF
On observing further , the extra delimiter was added after the last header .
Whereas there are only 22 fields which are mapped and not sure why the extra delimiter was added at the last thereby it is considered as an additional field here and causing concern while reading the file .
Thanks,
Harshavardhana
Related Content
- 10 months ago
- 4 years ago