On Feb 25, 3:27 am, SWilk <wilkola...@gmail.com> wrote:
> It's not that Richard does want to use it. It's that the PHP
> json_encode() function produces inconsistent output for empty arrays.
> If you do
> json_encode(array('key' => 'value');
> you will get:
> { key: value };

And I assume that `json_encode(array('a', 'b', 'c'))` returns `["a",
"b", "c"]`?


> I think in most cases:
> var _a=[];
> _a = (Object.isArray(_a) && !_a.length) ? {} : _a;
> var hash = $H(_a);

That should work, but wouldn't you want to differentiate between these
"broken" arrays (which should really be empty objects) and the actual
empty arrays (returned from json)?

You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to