JSFiddle - React, Tailwind, and code Playground

by Ben Alman

HTML

<script src="https://raw.github.com/cowboy/jquery-misc/master/jquery.ba-serializeobject.js"></script>
<script src="https://raw.github.com/gist/1025817/jquery.ba-deparam.js"></script>
<form id="a">
    <input type="hidden" name="foo" value="a"/>
    <input type="hidden" name="foo" value="b"/>
    <input type="hidden" name="foo" value="c"/>
    <input type="hidden" name="bar[]" value="a"/>
    <input type="hidden" name="bar[]" value="b"/>
    <input type="hidden" name="bar[]" value="c"/>
    <input type="hidden" name="baz[0]" value="a"/>
    <input type="hidden" name="baz[1]" value="b"/>
    <input type="hidden" name="baz[2]" value="c"/>
</form>

<div id="log"></div>

CSS

pre {
    margin-bottom: 1em;
}

JavaScript

function logJSON(obj) {
    log(JSON.stringify(obj, null, 2));
}

function log(msg) {
    $("#log").append("<pre>" + msg + "</pre>");
}

log("Naive serializeObject plugin:");
logJSON( $("#a").serializeObject() );

log("Full deparam:");
logJSON( $.deparam($("#a").serialize()) );