This is a very simple code, i'm writing it right now so it's better to test it before:
var form=document.getElementById("myform"); //Your form
var inp=form.getElementsByTagName("input"),
sel=form.getElementsByTagName("select"),
tex=form.getElementsByTagName("textarea");
var i, parts=[];
//Select
for(i=0;i<sel.length;i++)
if(sel[i].name) parts.push('"'+sel[i].name+'":"'+encodeURIComponent(sel[i].value)+'"');
//Textarea
for(i=0;i<text.length;i++)
if(tex[i].name) parts.push('"'+tex[i].name+'":"'+encodeURIComponent(tex[i].value)+'"');
//Input
for(i=0;i<inp.length;i++)
{
if(!inp[i].name) continue;
if((inp[i].type!="checkbox" && inp[i].type!="radio") || inp[i].checked) parts.push('"'+inp[i].name+'":"'+encodeURIComponent(inp[i].value)+'"');
}
var JSONStr="{"+parts.join(",")+"}";
Anyway this does not handle some cases like multiple selects, disabled or read-only inputs etc...