Response Block - Missing Semicolon

When using the response block, I put in the simplest of objects, and it is telling me I have a missing semicolon?

image

and adding one does nothing to help
image

Hello @khill-fbmc,

I performed several tests and here are my conclusions:

Even with that warning from Retool you can still run the notification and get the expected result.

However if you don't want to see that error or if it's not working in your case, you can implement one of the following solutions:

Solution 1: Enclose in Backticks

Try enclosing the JSON object in backticks to ensure it's treated as a string:

`{ "status": "OK" }`

Solution 2: Use an Array

Alternatively, you can return the object inside an array:

[{ "status": "OK" }]

Hope this helps! :grinning:

1 Like

Solution 1 seems better than 2 since I don't want to have to unwrap the array on the receiving end.

I will have to test if it works with something complex, like `{{ code1.data }}` might have to do JSON.stringify(code1.data)... hmmm

This has been similarly noted here as well - @Jack_T, FYI.

1 Like

Hello @khill-fbmc!

Both of @joao_boldtech solutions should work, as you mentioned you would have to stringify/JSONify the data which is not ideal.

I have reported this bug to our eng team to fix as it is the linter which thinks there is an error in the object when there isn't one, as it will run fine but will show red.

As @jg80 linked to the other post where I investigated this, if you add in a ; inside the object the error message will go away.

{"status": "OK"; }

Should work for your example, I noted in the bug patch note that it should be a comma separating key-value pairs and not semicolon separated, hopefully this will be fixed on our end soon!

1 Like