This is kinda hardcore but still works: http://jsfiddle.net/oskar/AZwgz/2/

O.

On 12 Jun 2010, at 09:35, אריה גלזר wrote:

> yep.
> 
> but doing something that isn't order specific and infinite depth is extremely 
> expensive - i would need to go key-by-key, check if 2 objects have them, and 
> then check if they are objects and so on. this is a lot of work for the 
> browser for something that can happen quite a lot on my application - to be 
> more specific - HistoryManager - where creating a noticeable delay is not an 
> option. since he keys are JS generated, i can assume that they are in the 
> same order.
> 
> On Sat, Jun 12, 2010 at 10:19 AM, amadeus <amadeusdema...@gmail.com> wrote:
> Couldn't this cause some problems if the key:val pairs aren't written
> out in the same order?
> 
> var obj1 = { cool:'sauce', abc:1 };
> var obj2 = { abc:1, cool:'sauce' };
> 
> JSON.encode(obj1);
> // returns "{"cool":"sauce","abc":1}"
> 
> JSON.encode(obj2);
> // returns "{"abc":1,"cool":"sauce"}"
> 
> Even though technically speaking, they both have 'identical
> data' (whatever that means :) )
> 
> 
> 
> -- 
> Arieh Glazer
> אריה גלזר
> 052-5348-561
> 5561

Reply via email to