I would like to convert an entire form of data to a javascript object.
<form id='myform'>
<input type='text' name='field1' value='foo'>
<input type='text' name='field2' value='bar'>
</form>
would convert to a javascript object...
{
field1: 'foo',
field2: 'bar'
}
In MooTools you can do easy trick how to convert all forms values into the Object:
var formObjects=$('myform').toQueryString().parseQueryString();
Convert to JSON:
var formJson=JSON.encode(formObjects);