How do you recursively remove nested objects that contain an empty array?
<p>I initially receive an AJAX response of <code>{"B":{"1":"100","3":{"AA":256}},"A":100}</code> and converted to a javascript object:</p>

<pre><code>var jsonOBJ = {};
jsonOBJ = jQuery.parseJSON(data);
</code></pre>

<p>Future responses can be subsets or supersets of the initial response. If the value of a table is unchanged at the server, the stagnant data is replaced with an empty array.  Example:</p>

<p><code>{"B":{"1":"90","2":200,"3":[]}}</code></p>

<p><code>{"B":[],"A":20}</code></p>

<p>Everytime an AJAX response is received, the object is updated with:</p>

<pre><code>jQuery.extend(true, jsonOBJ, jQuery.parseJSON(data));
</code></pre>

<p>But I need the javascript object to keep the unchanged portions, so I need to end up with an object that would be equivalent to the following with the example responses above:</p>

<pre><code>jsonOBJ = jQuery.parseJSON('{"B":{"1":"90","2":200,"3":{"AA":256}},"A":20}');
</code></pre>

<p>My preferred option would be to remove the empty objects from the converted response.  Is there an existing function or a modification to the jQuery extend function that would do this?</p>
