Re: Error inserting JSON string to Postgres DB

2023-12-02 Thread Jun Zhuang
Got it working. Thanks again for your help Felix! 3 things I had to do: - Use TWO double quotes for every double quote, so {"name": "whatever"} becomes {""name"": ""whatever""} - Put the final JSON string in double quotes when making the insertion request. Single quotes don't work!

Re: Error inserting JSON string to Postgres DB

2023-12-02 Thread Felix Schumacher
Hi Jun, I have attached a working minimal example, that uses a JSON string and inserts that with a prepared statement. It assumes a locally running postgres which can be changed of course. The interesting part is: * You have to escape comma and quotes in the JSON string.   Given a JSON

Re: Error inserting JSON string to Postgres DB

2023-12-02 Thread Felix Schumacher
Hi Jun, I am not sure, what you tried already. When I place the following text into a JDBC Sampler's query field, I get no errors: createtablesomething(idint,datajson); insertintosomethingvalues(1,'{"name": "whatever"}'::json); Same result, when I remove the casting and use