[Feature Request] Handle deserialization of objects within arrays

Right now when passing parameters through jQuery, it serializes something like:

{ order: [{ name: “last_name”, dir: “asc” }, name: “first_name”, dir: “asc” }] }

Into:

order%5B0%5D%5Bname%5D=last_name&order%5B0%5D%5Bdir%5D=asc&order%5B1%5D%5Bname%5D=first_name&order%5B1%5D%5Bdir%5D=asc

Then on the Rails side, it gets interpreted as:

{“order”=>{“0”=>{“name”=>“last_name”, “dir”=>“asc”}, “1”=>{“name”=>“first_name”, “dir”=>“asc”}}}

At first thought it looked like a bug, but it’s really a problem with how the serialization/deserialization can be interpreted. Here’s an article that goes further into it: Ben Alman » jQuery 1.4 $.param demystified

Since this is such a common problem, can something be built into Rails to handle it? I would love if it worked by default, but I guess since you might sometimes want the current output, maybe there’s a flag that can be passed to tell Rails to convert the hash into an array. Let me know if there are better alternatives.

I know there are some solutions available, such as using JSON.stringify, but that won’t work with GET requests.

Thanks,

Tom