Create nested json object using jquery
<p>Using json object not from array.</p>

<pre><code>$(document).ready(function () { 
    var editeditems = {}; 
    var address = {};
    var firstName;
    var lasteName; 
    $('#btnJson').click(function () { 
        for (var i = 0; i &lt; 3; i++) { 
            address["street"] = i; 
            address["city"] = i; 
        } 
        editeditems["FirstName"] = "mehul"; 
        editeditems["LastName"] = "gohel"; 
        editeditems["Address"] = address; 
        $('#txtVal').text(JSON.stringify(editeditems)); 
    }); 
});
</code></pre>

<p>I am using this code and get output of:</p>

<pre><code>{
   "firstName": "Mehul",
   "lasteName": "Gohel",
   "address": [
      {
         "Street": 0,
         "City": 0
      },
      {
         "Street": 1,
         "City": 1
      }
   ]
}
</code></pre>