This message was deleted.
# help
s
This message was deleted.
o
Using double quotes enforces the string type in JSON and YAML.. Just try an extension without quotes
l
Just had a play around with this locally as I have this running standalone. When using the
jsonBody
element to define the response payload, the
"
need to be there for it to be valid json. This means your integer will always go back as a string. If I change the
jsonBody
to use the
body
element instead I don’t have to worry about it being valid json so can remove those quotes. The downside is that you have to escape the json but it seems to work:
Copy code
"response": {
    "status": 202,
    "headers": {
      "Content-Type": "application/json"
    },
    "body": "{\"number\": {{math 1 '*' 3}} }",
    "transformers": ["response-template"]
  }
Results in:
Copy code
{
  "number": 3
}
r
That worked! Thanks for the help!
👍 2