jsonQ.js
function newFormat(option) {
        //parameter change
        var keyAdded = option.keyAdded || [],
            json = option.json,
            path = option.path,
            newJson = option.newJson;
        //add to new json

        jsonQ.each(json, function(k, val) {
            var lvlpath = path ? JSON.parse(JSON.stringify(path)) : [];
            lvlpath.push(k);

            //to add a new direct access for each key in json so we get the path of that key easily
            if (objType(json) == 'object') {
                if (keyAdded.indexOf(k) == -1) {
                    keyAdded.push(k);
                    newJson.jsonQ_path[k] = [];
                }

                newJson.jsonQ_path[k].push({
                    path: lvlpath
                });
            }
            //if value is json or array go to further level
            var type = objType(val);
            if (type == 'object' || type == 'array') {
                newFormat({
                    'json': val,
                    'newJson': newJson,
                    'path': lvlpath,
                    'keyAdded': keyAdded
                });
            }


        });

        return newJson;
    }
function newFormat(option) {
        //parameter change
        var keyAdded = option.keyAdded || [],
            json = option.json,
            path = option.path,
            newJson = option.newJson;
        //add to new json

        jsonQ.each(json, function(k, val) {
            var lvlpath = path ? JSON.parse(JSON.stringify(path)) : [];
            lvlpath.push(k);

            //to add a new direct access for each key in json so we get the path of that key easily
            if (objType(json) == 'object') {
                if (keyAdded.indexOf(k) == -1) {
                    keyAdded.push(k);
                    newJson.jsonQ_path[k] = [];
                }

                newJson.jsonQ_path[k].push({
                    path: lvlpath
                });
            }
            //if value is json or array go to further level
            var type = objType(val);
            if (type == 'object' || type == 'array') {
                newFormat({
                    'json': val,
                    'newJson': newJson,
                    'path': lvlpath,
                    'keyAdded': keyAdded
                });
            }


        });

        return newJson;
    }
function newFormat ( option ) { //parameter change var keyAdded = option . keyAdded || [ ] , json = option . json , path = option . path , newJson = option . newJson ; //add to new json jsonQ . each ( json , function ( k , val ) { var lvlpath = path ? JSON . parse ( JSON . stringify ( path ) ) : [ ] ; lvlpath . push ( k ) ; //to add a new direct access for each key in json so we get the path of that key easily if ( objType ( json ) == 'object' ) { if ( keyAdded . indexOf ( k ) == - 1 ) { keyAdded . push ( k ) ; newJson . jsonQ_path [ k ] = [ ] ; } newJson . jsonQ_path [ k ] . push ( { path : lvlpath } ) ; } //if value is json or array go to further level var type = objType ( val ) ; if ( type == 'object' || type == 'array' ) { newFormat ( { 'json' : val , 'newJson' : newJson , 'path' : lvlpath , 'keyAdded' : keyAdded } ) ; } } ) ; return newJson ; }
function to create new format
function to create new format