php/php-src — pull request #454 by datibbaw (2013-09-17 07:22:24+00:00)
Title: json_encode(): option to only encode empty arrays as objects

The JSON_FORCE_OBJECT option *always* encodes arrays as JSON objects, but there are cases in which you know the array will have only associate keys at a later stage.

I've created the JSON_FORCE_EMPTY_OBJECT to encode only empty arrays as objects. Numerically indexed arrays retain their regular [] encoding.