Mapping Single Record or Multiple Record

Hi all,

When Designing Pipelines,we are getting response using the Get method,

  1. Sometimes we will get only one record in the response we need to use the different mapping,
  2. Sometimes we will get the multiple records in the response we need to use different mapping(because response getting is array).
    Can’t we use only one mapping in above Condition,

Please help me on this,


Use sl.ensureArray($response) and then use json splitter. It should work.

1 Like

Hi @anilv,

Best approach is to use sl.ensureArray() function and put the response from Get request as parameter of the function(ex: sl.ensureArray($response)). In this way you will ensure that the response from Get request will be always array. After that you can you JSON Splitter snap and split the array into separate JSON documents.

If you have any questions fell free to contact me.


1 Like