using dataFilter from jquery .ajax with json data
<p>how can i produce a modified vaild JSON data string from the JSON data coming from the ajax call. it is necessary to do this with dataFilter.</p>

<p>retData (data returned) from ajax call is:</p>

<pre><code>{"8":"vacation","7":"birthday","5":"summer","4":"2013","3":"2014","6":"winter","2":"2015","1":"2016"}
</code></pre>

<p>JS code:</p>

<pre><code>'dataFilter': function (retData, json) {
    console.log('retData='+retData);
    data = [];
    $.map(retData, function (value,key) {
        console.log('indx=i'+key+', value='+value);
        node = {
            'id' : 'i'+key,
            'text' : value,
            'icon' : '/',
            'data' : value,     //'metadata' :  value,
            'state' : {'opened' : false},
            'children' : true
        }
        data.push( node );
    });
    console.log('final-data='+data);
    return data;
    //return JSON.stringify(data);
}
</code></pre>

<p>but instead i am getting error in browser console: it seems $.map is having the issue when run in 'dataFilter', it runs fine in 'success' call (but plugin strictly wants processing to be done in 'dataFilter')</p>

<pre><code>TypeError: invalid 'in' operand a
https://www.localhost.com/jscript/jquery/jquery-2.2.0.min.js
Line 2
</code></pre>