I am using the Yii2 model, which is connected to the PostgresQL database. I have a behavior that encodes and decodes some attributes of this model to / from json. For encoding / decoding, I use the Json helper, the Json::encode and Json::decode .
The table column is of type json. An example of what gets into the database:
"{\"additional_tags\":[\"#\",\"#\"],\"vk\":\"vk.com\\\/privetik\"}"
When I try to decode it back to a php array, here is what came back instead:
'{"additional_tags":["#","#"],"vk":"vk.com\/privetik"}'
EDIT: think about it, the line seems fine, but the behavior of the ::decode method is weird. Essentially, all he does is delete the slash copies, not convert it to a php array or throw an exception.
What should I do to fix this? Appreciate any feedback.
nainy source share