actually here is the html code
<div id="sheet" class="inner" style="display: block;"> <div> <input id="size1" type="text"> </div> <div> <input id="size2" type="text"> </div> </div> javascript
$('body .frontend-setup-form #secure').click(function (e) { e.preventDefault(); var json; var shirts = []; var shirt = []; $('body .frontend-setup-form #sheet input').each(function () { if($(this).val()!='') { shirt['name'] = $(this).attr('id'); shirt['value'] = $(this).val(); shirts.push(shirt); } }); json={shirts:shirts} console.log(JSON.stringify(json)); getting
{"shirts":[[]]} I would like to
{ "name":"patern", "shirt": [ { "name": "size1", "value": "размер1" }, { "name": "size2", "value": "размер2" } ] }