jsonObj = []; $("input[class=lookup]").each(function() { var code = $(this).attr("title"); var descr = $(this).val(); item = {}; item["code"] = code; item["descr"] = descr; jsonObj.push(item); }); var jsonString = JSON.stringify(jsonObj);
var jsonString = "[{"code":"BA","descr":"The Boeing Company"},{"code":"CSCO","descr":"Cisco Systems, Inc"},{"code":"IBM","descr":"International Business Machines Corporation"}]"; var oList = jQuery.parseJSON(jsonString);