search

Home  >  Q&A  >  body text

mysql storage json error

Recently, I have been using mysql's json storage format, and a very strange problem has occurred.

INSERT INTO `json` (`notes`) VALUES ('[{"name":1}]');
I use the above statement to insert the json array, and the display of navicat is normal The

When I use
UPDATE json SET notes =json_array_append(notes, '$' , '["sa"]' ) WHERE ID=6 ;The escape character appears when adding new json

What's the problem?

phpcn_u1582phpcn_u15822734 days ago904

reply all(1)I'll reply

  • 黄舟

    黄舟2017-06-06 09:54:13

    json_array_append(notes, '$' , '["sa"]' ) 改为json_array_append(notes, '$' , CAST('["sa"]' AS JSON))

    reply
    0
  • Cancelreply