Welcome Guest, Not a member yet? Register   Sign In
Json in entity have backslashes
#1

I add an array to the property, which is converted to JSON.

In the original, the caster produces a good result, but when saving to an entity (not yet saved to the database), backslashes appear in output:

PHP Code:
//  is wrong string (json-array)
$entity->attributes['tables'string (29""[\"one\",\"two\",\"three\"]""

// cast after normally
$entity->tables string (21) "["one","two","three"]"

// raw casting array
json_encode(...) string (21) "
["one","two","three"]


where problem?
Simple CI 4 project for beginners codeigniter-expenses ( topic )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB