cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Mapping Single Record or Multiple Record

anilv
New Contributor II

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,

Thanks,
Anil

2 REPLIES 2

Supratim
Contributor III

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

SpiroTaleski
Valued Contributor

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.

Regards,
Spiro