ID: 50166 Updated by: j...@php.net Reported By: dumpbox at mail dot ru -Status: Open +Status: Bogus Bug Type: JSON related Operating System: Windows XP PHP Version: 5.2.11 New Comment:
Yes, that would be an array in JSON. Please check http://www.json.org/ for the syntax. No bug here. (and yes, assoc arrays do end up as objects..) Like this: [j...@localhost ~]$ php -r 'var_dump(json_encode(array("foo" => "bar")));' string(13) "{"foo":"bar"}" [j...@localhost ~]$ php -r 'var_dump(json_encode(array("foo", "bar")));' string(13) "["foo","bar"]" No bug here. Previous Comments: ------------------------------------------------------------------------ [2009-11-13 13:59:41] dumpbox at mail dot ru Description: ------------ By default json object starts with "{" and ends with "}" Error occurs when user attempt encode empty array. Reproduce code: --------------- echo json_encode(array()); Expected result: ---------------- {} Actual result: -------------- [] ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50166&edit=1