ZF-7157: Zend_Json should support JavaScript comments


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.


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.

Im using Zend_Json::decode() and leveraging the Json module (1.2.1). Im using PHP 5.2.6 and ZF 1.8.3

Zend_Json::decode() defaults to using ext/json when enabled -- which means your issue is upstream. Please report it at http://bugs.php.net/

Closing as "Won't Fix" as the issue is upstream.