I have the following json string inside an associative array:
[watch] => '{"tv":"Dexter's Labratory, \u05d1\u05d9\u05d3\u05d5\u05e8 \u05d9\u05e9\u05e8\u05d0\u05dc\u05d9 HOT, South Park, \u05e2\u05e1\u05e4\u05d5\u05e8, Teenage Mutant Ninja Turtles, Simpsons, The Samurai Pizza Cats, Dr. House, Futurama, House","movies":"Mufasa, Simba, \u05d7\u05d9\u05d9\u05dd \u05d1\u05e1\u05e8\u05d8, \u05e1\u05e8\u05d8\u05d9\u05dd \u05d7\u05d3\u05e9\u05d9\u05dd \u05d1\u05e7\u05d5\u05dc\u05e0\u05d5\u05e2, Future Shorts Israel, The Lion King"}'
Of course it needs to be escaped because it contains characters like ' inside (e.g Dexter's Labratory). The problem is that after using mysql_real_escape_string on it the output is:
[watch] => \'{\"tv\":\"Dexter\'s Labratory, \\u05d1\\u05d9\\u05d3\\u05d5\\u05e8 \\u05d9\\u05e9\\u05e8\\u05d0\\u05dc\\u05d9 HOT, South Park, \\u05e2\\u05e1\\u05e4\\u05d5\\u05e8, Teenage Mutant Ninja Turtles, Simpsons, The Samurai Pizza Cats, Dr. House, Futurama, House\",\"movies\":\"Mufasa, Simba, \\u05d7\\u05d9\\u05d9\\u05dd \\u05d1\\u
It escapes a shitload of stuff that should not be escaped, especially all the " characters (that I am pretty sure are part of the json encoding) making it not query-able. What's the right method to escape a json string? I guess I am missing something here.