Looking for a jquery plugin to serialize a form to an object

Posted by John on Stack Overflow See other posts from Stack Overflow or by John
Published on 2010-05-18T05:28:53Z Indexed on 2010/05/18 5:30 UTC
Read the original article Hit count: 155

Filed under:
|

I'm looking for a jQuery function or plugin that serializes form inputs to an object using the naming convention for deep-serialization supported by param() in jQuery 1.4:

<form>
  <input name="a[b]" value="1"/>
  <input name="a[c]" value="2"/>
  <input name="d[]" value="3"/>
  <input name="d[]" value="4"/>
  <input name="d[2][e]" value="5"/>
</form>

$('form').serializeObject(); // { a: { b:1,c:2 }, d: [3,4,{ e:5 }] }

Prototype's Form.serialize method can do exactly this. What's the jQuery equivalent? I found this plugin but it doesn't follow this naming convention.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery