Answer the question
In order to leave comments, you need to log in
Why does mysql escape quotes in json?
Created a table, made the field type json.
I wrote an array from php into this field, after converting it to json. json nested. Everything was recorded as it should.
Now I add similar entries to this field using JSON_ARRAY_APPEND (), and as a result, this entry is added: "{/"prop1/":/"value1/"}" . The whole essence of json in mysql is lost.
PHP code:
$array=array(
"prop1"=>"value1",
"prop2"=>"value2"
);
$jsArr=json_enecode($array);
$sql="update user from friend set=JSON_ARRAY_APPEND(user,'$','".$jsArr."')";
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question