We cannot parse String to different data types when it is null or blank. We get Cannot coerce string to exception.
Use default keyword to fix this issue.
Sample code:
output application/json
---
payload map ( payload01 , indexOfPayload01 ) -> {
Stree: payload01."Applicant Address Street",
Birthdate: payload01."Applicant Birthdate" as Date default null,
BorrowerId: payload01."Applicant Borrower Id" as Number default null,
}
If “Applicant Birthdate” is blank or null, then null is set to Birthdate.
If “Applicant Borrower Id” is blank or null, then null is set to BorrowerId.