0
votes

How do I limit the number of records in the payload at dataweave level. For example here I am simply converting to json, but I need only 500 records in the output.

Mycode:

%dw 2.0
output application/json
---
payload
1

1 Answers

3
votes

Assuming the input is an array, you can use the slice() function:

%dw 2.0
import * from dw::core::Arrays
output application/json
---
slice(payload, 0, 500)