Saving array with jsonEditor & postgresql fails

  • Goal: Allow folks to create arrays at top level

  • Steps:

  • Create a form to edit or add a row in postgresql database.

  • Ensure table has a jsonb column type

  • Setup jsonEditor to set values in that column

  • try to put in a value like ["test", "second value"]

  • Details: The resulting update errors out with message: returning * - invalid input syntax for type json

  • Screenshots:


Hey @Ankit_Shah,

I looked into this a bit more and it does seem like a Retool bug :disappointed: I'll add your +1 to the bug report.

It looks like it works as expected if you use the key value pair changeset option:
Screenshot 2024-07-16 at 4.22.25 PM

but it needs to be stringified when using the form data object.

For the time being, you could use another component, as you had mentioned in office hours, or you could use Javascript to stringify the value within the form data (see image below where ['json'] is the form data key of your json editor component

I wanted to say that temporary workaround did the job for me. I look forward to underlying bug being addressed so I can remove this workaround.

2 Likes