Re: Error inserting JSON string to Postgres DB
Jun Zhuang <[email protected]> Sat, 2 Dec 2023 13:19:51 +0000 (UTC)
| Newsgroups | gmane.comp.jakarta.jmeter.user |
|---|---|
| Message-ID | <[email protected]> |
Hi Filex, Thanks for the response. I tried with the single quotes and singles quotes + ::json, still got the same error. Just to be sure, are you using a Postgres DB? Also one thing I forgot to mentioned in my original email was the field I am trying to insert into is of data type text instead of varchar, I wonder if that makes any difference? Following are some screenshots of what I am trying to do: On Saturday, December 2, 2023 at 05:58:52 AM EST, Felix Schumacher <[email protected]> wrote: 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: create table something (id int, data json); insert into something values (1, '{"name": "whatever"}'::json); Same result, when I remove the casting and use create table something (id int, data json); insert into something values (1, '{"name": "whatever"}'); Can you show us a minimal example that fails for you? Regards Felix Am 01.12.23 um 23:24 schrieb Jun Zhuang: > Hi, > I am getting Cannot have quote-char in plain field:['{"] error when trying to insert a JSON string into a Postgres DB table using JDBC request. > I tried the following but nothing worked: > - place the JSON string in single quotes, > - escaping the double quotes with \", > - placing the string in $$<JSON string here>$$ but nothing worked. > There is no issue with the connection and other select/insert queries and I was able to insert from pgAdmin with the same string in single quotes though. > The JSON string looks like this: {"A":"A", "B":[{"C":"C"}]} > I am really out of ideas at this time. Can someone help? > Thanks,Jun > > --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
1701522762972blob.jpg
(image/png, 78.6 KB) - not displayed
1701522892207blob.jpg
(image/png, 66.6 KB) - not displayed
1701522938115blob.jpg
(image/png, 26.1 KB) - not displayed