ZF-7157: Zend_Json should support JavaScript comments
Description
Currently if you try and decode a JSON value that contains a comment like:
// comment
{"foo": "bar"}
The result is a single string property (zend_debug::dump):
string '// comment
{"foo": "bar"}' (length=25)
It would be nice if Zend_Json were able to identify and strip the "//" and /* */" based comments prior to decoding so that JSON strings with comments would parse as expected.
Comments
Posted by Matthew Weier O'Phinney (matthew) on 2009-06-29T13:09:02.000+0000
I need a little input before working on this. First, is ext/json enabled in your PHP installation? Second, how are you decoding JSON values -- via Zend_Json::decode()? or are you going straight to Zend_Json_Decoder?
I ask the questions as I'm trying to determine if the problem exists in Zend_Json, or upstream in ext/json.
Posted by Larry Root (lroot) on 2009-06-29T13:22:03.000+0000
Im using Zend_Json::decode() and leveraging the Json module (1.2.1). Im using PHP 5.2.6 and ZF 1.8.3
Posted by Matthew Weier O'Phinney (matthew) on 2009-06-29T13:31:38.000+0000
Zend_Json::decode() defaults to using ext/json when enabled -- which means your issue is upstream. Please report it at http://bugs.php.net/
Posted by Matthew Weier O'Phinney (matthew) on 2009-06-29T13:32:10.000+0000
Closing as "Won't Fix" as the issue is upstream.