Re: Removing basic types from our JSON parser

From: Date: Sun, 14 Dec 2008 17:29:59 +0000
Subject: Re: Removing basic types from our JSON parser
References: 1 2 3 4 5 6 7 8 9 10 11 12 13  Groups: php.internals php.internals 
Request: Send a blank email to internals+get-42257@lists.php.net to get a copy of this message
-------- Původní zpráva -------- Předmět: [PHP-DEV] Removing basic types from our JSON parser Od: thetaphi@php.net (Uwe Schindler) Komu: Datum: 14.12.2008 10:40
<script> var foo = <?php echo json_encode($foo)?>; </script> will always work. The only question is what sort of variable foo will end up being. The RFC says we have to wrap basic types in an array or object, while currently we let the basic types through without the wrapper.
He problem her eis: A lot of people use in a way and assume, that a basic type is serialized as a basic type in JSON/JS. If we change this, it could break a lot of apps.
+1 In PHP there is no function for escaping JS strings and json_encode is useful compensation. I use it this way very often. David Grudl

« previous php.internals (#42257) next »