"Body is not a valid json" Error in Auth0 Flow

Trying to make call to API-2 from Auth0 Flow using HTTP Request
In the body, I need to pass a Boolean value to API-2 which is received from the response of API-1.

{
“email”: “{{context.user.email}}”,
“userId”: “{{context.user.user_id}}”,
“lastName”: “{{fields.lastName}}”,
“isReturningMember”: {{actions.http_request_my_details.body.data.isReturningMember}}
}

It gives error for isReturningMember - “Body is not a valid json” because I am not enclosing them in the quote.

If I update it with quotes to “isReturningMember”: “{{actions.http_request_my_details.body.data.isReturningMember}}”, the flow works but API-2 fails because it is expecting boolean but string is received in the request body.

How to fix this?

Hi @rbAuth0,

Can you tell me what is the value of {{actions.http_request_my_details.body.data.isReturningMember}} is?

Have a good one,
Vlad

For others facing similar issue, the solution is
“isReturningMember”: “{{functions.toBoolean(actions.http_request_personal_details.body.data.isReturningMember)}}”

Use functions.toBoolean and use quotes as well.