12-05-2023 10:01 AM
I have the below JSON output from a Union (below is just a subset of the results), which combines the output of 2 SOAP calls into the 2 arrays.
I'm trying to merge NCTimeTypes array with CHTimeTypes array to create a single array "TimeTypes" that contains the contents of both.
e.g. Transform this:
To this:
I've tried various approaches, the most appropriate feels like array.concat but i can't get it to work.
Can anyone help?
Solved! Go to Solution.
12-08-2023 10:46 AM
@nickhumble - my apologies - I missed your original response to my question.
If there are two input documents that you want to combine to a single document, I would recommend using the Gate snap in this case. Then follow with a Mapper snap with the following expression:
The jsonPath is a powerful function that allows you to rip through a JSON structure looking for specific sub-elements easily and return the results as an array. This specific syntax tells jsonPath to return all elements buried under the top three arrays.
Note that the Gate snap has some considerations when processing larger volumes of data, but for this case, it works very nicely. Also, the jsonPath documentation has some external links for additional details of how you can work with it along with some good examples.
Hope this helps!
12-06-2023 09:04 AM
@nickhumble - the input you have listed - is that 2 input documents, or one field value?
12-06-2023 09:49 AM
It's 2 input documents, thanks.
12-08-2023 09:00 AM
@koryknick any ideas? Thanks!
12-08-2023 10:46 AM
@nickhumble - my apologies - I missed your original response to my question.
If there are two input documents that you want to combine to a single document, I would recommend using the Gate snap in this case. Then follow with a Mapper snap with the following expression:
The jsonPath is a powerful function that allows you to rip through a JSON structure looking for specific sub-elements easily and return the results as an array. This specific syntax tells jsonPath to return all elements buried under the top three arrays.
Note that the Gate snap has some considerations when processing larger volumes of data, but for this case, it works very nicely. Also, the jsonPath documentation has some external links for additional details of how you can work with it along with some good examples.
Hope this helps!