Forum Discussion

Yashb81's avatar
Yashb81
New Contributor
2 years ago
Solved

Do JSON mapping in a single mapper

Hi Everyone,

This is my sample JSON data.

I want to map this data in a single mapper in order to get the result set below.

Currently I am using too many snaps to do the same. I want to reduce my number of snaps and get it done in 1 mapper.

  • Here are two ways you could accomplish this.

    The first is to copy the data into two streams, split, and then union it back up together. See the attached json-splitter-example for reference.

    The second is to use a Mapper to concat the two arrays together and then use a JsonSplitter afterwards to split on the new array so you have a document for each of the elements of the new array. See single-mapper-example as reference.

    Hope this is helpful.

     

2 Replies

  • Here are two ways you could accomplish this.

    The first is to copy the data into two streams, split, and then union it back up together. See the attached json-splitter-example for reference.

    The second is to use a Mapper to concat the two arrays together and then use a JsonSplitter afterwards to split on the new array so you have a document for each of the elements of the new array. See single-mapper-example as reference.

    Hope this is helpful.