Skip to content
Advertisement

Data truncation: ” While Inserting or Updating Value

I am trying to Insert/update a string (JSON). While inserting/Updating the value I get data truncation error.

I have tried making a JSON type column and passing an JSON_OBJECT() type but that fails as well.

// That Works


Yields same result (Id’s and data varies) but doesn’t work

Result Set

Advertisement

Answer

If you want to store JSON object, you should use the JSON datatype instead of strings. To create a JSON object, you can use JSON_OBJECT.

If you need a JSON array as shown in your sample data, then :

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement