2

I have a JSON column and i am using the following syntax...

INSERT INTO myTable (myJSONColumn) VALUES (["test1", "test2", "test3"])

Every resource i can find seems to say the above should be correct. What am i missing?

3
  • What makes you think it is wrong? Are you getting an error? If so, it might be helpful if you shared that error with us Commented May 9, 2017 at 18:59
  • You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '["string1","string2","string3"])' at line 1 Commented May 9, 2017 at 19:01
  • Every resource? The offical doc doesn't show this syntax: dev.mysql.com/doc/refman/5.7/en/json.html Commented May 9, 2017 at 19:06

1 Answer 1

2

You want to insert single value (one column), so put everything in '' like:

INSERT INTO myTable (myJSONColumn) VALUES ('["test1", "test2", "test3"]')
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, could have sworn i tried that but now it seems to work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.