Mapping Single Record or Multiple Record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2019 11:52 PM
Hi all,
When Designing Pipelines,we are getting response using the Get method,
- Sometimes we will get only one record in the response we need to use the different mapping,
- 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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-23-2019 12:10 AM
@anilv
Use sl.ensureArray($response) and then use json splitter. It should work.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-23-2019 04:57 AM
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
