Error in JSON body when variable is used without quotes

I am trying to send a POST request with a JSON body where values are variables. All the variables that are surrounded by double quotes work fine. The ones that are not such as Numbers and Booleans are throwing errors. Their values need to be sent without quotes as the API understands them like that. How can I do that ion Postman?


The error is in your pre-request script.

What is going on in there?

If you try and parse the body in a pre-request script, it will fail on the values that are not strings as those details only get transposed when the request is submitted.

Therefore it will be treating the value for the “openingBalance” key as {{openingBalance}} which is not valid JSON at that point.

So until the request is submitted, the JSON will not be valid, hence the error message.