I have forms with inputs of hidden and visible like below.In this example I want to serialize only name=\'country\' which is not hidden
You can make a temporary copy of it and remove the hidden inputs from it before serializing :
var form = $("#finalform").clone();
$(form).find("input[type=hidden]").remove()
var serialized = $(form).serializeArray();
Here is another possible solution with a demo.
var notHidden = $('#finalform > :not(input[type=hidden])').serializeArray();
$('#itemsSerializedCount').text($(notHidden).length)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/json2/20140204/json2.js"></script>
<form id="finalform">
<input type='hidden' name='sid' value='901271316' />
<input type='hidden' name='tco_currency' value='USD'>
<input name='country' value='India' />
</form>
<lablel id="itemsSerializedCount"></label>
Here, the input control which is not hidden is serialized.
I find this a cleaner way of doing it:
var frm = $('#finalform [type!="hidden"]').serialize()
use below code . not(:hidden)
will not include input type hidden in serialize()
check DEMO
var frm = $('#finalform').find(":input:not(:hidden)").serialize();
Or
var frm = $('#finalform :input:not(:hidden)').serialize();
DEMO
var frm = $('#finalform :input:not(:hidden)').serializeArray();
var frm1 = $('#finalform').find(":input:not(:hidden)").serializeArray();
$('#firstOutput').text(JSON.stringify(frm))
$('#secondOutput').text(JSON.stringify(frm1))
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<form id="finalform">
<input type='hidden' name='sid' value='901271316' />
<input type='hidden' name='tco_currency' value='USD'>
<input name='country' value='India' />
</form>
<div id="firstOutput"> </div>
<div id="secondOutput"> </div>