Re: [Rails] cookie has key/value pairs and lost order after JSON decode

2010-05-28 Thread Andy Jeffries
>  ActiveSupport::JSON.decode(cookies['item_list']) > > and the result is actually in a hash, then the ordering is lost... > > Is it true that if the original JSON object has an array of hashes (1 > key and 1 value), then the order can be preserved? > > But what if the original JSON object was a ha

[Rails] cookie has key/value pairs and lost order after JSON decode

2010-05-28 Thread Jian Lin
If a cookie has several items, and is encoded as JSON text as the value of the cookie, the order is actually apparent in the cookie's text But if JSON.decode is used: ActiveSupport::JSON.decode(cookies['item_list']) and the result is actually in a hash, then the ordering is lost... Is it true