Marking as an enhancement. We need to make sure this is something that all communities would benefit from. We got some pretty negative feedback on changing the param stuff to support a few languages in 1.4.2, and not others. Anyone want to weigh in? Is this directly related to that change?

An object with an array of objects as one of its properties should not serialize out this way.

The bug is in buildParams, in the portion where it serializes an object - that portion of the else statement is doubly broken - it both places [ ] around object property names instead of passing a serialized object, and in other scenarios completely loses data by passing empty arrays like list[] when list is an object with basic properties like strings.

That said, it would appear the solution is to use JSON.stringify from json2 on all data passed to jquery, rather than to fix this code, considering the author of JQuery is begging coders to do so:

I think param does the correct behavior. Data is not lost, but it does not automatically go to JSON form because that is not the default for decoding arrays to uri. If you want JSON, encode to JSON before passing to param. We could theoretically add JSON encoding to jQuery and provide param with an argument on whether it should decode into stringified JSON, but I don't think it should be the default.

Unfortunately, there is no universally agreed-upon spec or RFC for "params strings" and as such, it's virtually impossible to encode very complicated nested data structures in a way that works across all frameworks or languages that support these "modern" params strings.

The current jQuery $.param implementation has been tested and is working (with minor, documented, exceptions) in both PHP and Ruby on Rails environments, and I'd be hesitant to make additional changes.

Perhaps a two-fold approach of a) documenting this issue and b) recommending that JSON be used for transmitting more complex data structures (nested arrays, mainly) to the server would be useful.

Based on cowboy's feedback above, I am going to close this with 'cantfix' as there is no "right way" to do this, and recommending that we mention his suggestion to use JSON to send arbitrarily nested objects over the wire in the docs.