How to get the values of sub objects of json objects while using object.key method?
<p>By using an api and getting a response .In response, i have got the list of objects in deals named object and the count of these object is 19 .I have used the below function to get the 'keys' and 'values' of each object.But some keys which is ultimately an object has sub object that contains keys and values ,i have tried but i m unable to access them.I have given below the snippet of response of an api call.Here I'm able to access the object at index 0's active  but for business i got [object object] because it has keys and values inside it i.e 'id',that i'm unable to access ,i want to access them too.</p>

<pre><code> meta: Object
       response: Object
           deals: Array[20]
                0: Object
                    active: 1
                    business: Object
                       id: 608290.....
</code></pre>

<p>Below is the function  to get the keys as well as values of all the objects</p>

<pre><code>function getAllobjectData(data) {
    $.each(data.response.deals, function (i, deals) {
        console.log("value of index " + i);
        var keys = [],
            values = [];
        $.each(deals, function (key, value) {
            keys.push(key);
            values.push(value);
            var subkey = [],
                subvalue = [];
</code></pre>

<p>This part i add and tried to get the subobjects keys and values but it didnt work and i dont know is this a correct way.          </p>

<pre><code>$.each(key, function (subkey, subvalue) {                          &lt;-------------      
                    alert(subkey + ": " + subkey);                              -
                });                                                             -
                console.log('subkey ' + (i + 1) + ' is ' + subkey);             - 
                console.log('subvalue ' + (i + 1) + ' is ' + subvalue);         -
   ----------------------------------------------------------------------------- 
            });
            console.log('keys ' + (i + 1) + ' is ' + subkey);
            console.log('values ' + (i + 1) + ' is ' + subvalue);

        });
    }
</code></pre>
