jQuery form serializeArray

Transform form elements into an array of objects and then stringify the array of objects. Note that JSON does not work in some older browsers such as IE7.

HTML

<form>
    <input type="text" id="t1" name="fullname"  value="asd"/>
    <input type="text" id="t2" name="fullname" value="asdf"/>

    <br/>
 
</form>
<input type="button" value="go" id="b1" />

JavaScript

if ("JSON" in window) console.log("Yes, json"); else console.log("no json");

$(function(){
    $("#b1").on("click", function(){
       var a = $("form").serializeArray();
       console.log(a);
       var s = JSON.stringify(a);
        console.log("s is ", s);        
    });
});