Skip to content

Instantly share code, notes, and snippets.

@scott-kloud
Created October 10, 2016 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scott-kloud/f77623117e7668cc894615d49cfade72 to your computer and use it in GitHub Desktop.
Save scott-kloud/f77623117e7668cc894615d49cfade72 to your computer and use it in GitHub Desktop.
%dw 1.0
%output application/json
%namespace ns0 http://ns0.com.au/api/invoices
---
(
payload.ns0#invoiceResponse.ns0#invoices.*ns0#invoice map ((invoice , indexOfInvoice) -> {
invoiceNo: indexOfInvoice,
invoiceDate: invoice.ns0#date as :datetime as :string {format: "dd/MM/YYYY HH:mm:ss"},
billingTime: invoice.ns0#billingHours
})
)
when payload.ns0#invoiceResponse.ns0#invoices is :object
otherwise []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment