Invalid input syntax for type json with jsonb column

What result do you get if you run JSON.parse(yourObject) in the console? I believe it’ll be expecting a string there instead of an object.

The best way IMO to ensure proper JSON formatting here is to build it as a JS object and then use JSON.stringify(yourJsObject) when you go to insert it.

1 Like