In my web app I need to store JSON in one of the database fields (just one field). On the backend side (PHP) I am converting array to json via json_encode()
.
The output of the above is:
[{"przyczyna":"Niezgodno\u015b\u0107"}]
Which is encoded:
[{"przyczyna":"Niezgodność"}]
And this is correct.
Then I am sending this string to my database via mysqli
(standard $mysqli->query()
).
And when I go to my database I can see that the field has value:
[{"przyczyna":"Niezgodnou015bu0107"}]
The backslashes are gone and I can't properly decode it. How can I upload this to my database without backslashed being stripped? On the PHP side and database (MySQL
) I am using utf8
coding. I tried to use utf8mb4
but the result was the same.