versions/jsonc.js
function _getKeys(json, aKeys) {
    var aKey,
      sKey,
      oItem;

    for (sKey in json) {

      if (json.hasOwnProperty(sKey)) {
        oItem = json[sKey];
        if (_isObject(oItem) || _isArray(oItem)) {
          aKeys = aKeys.concat(unique(_getKeys(oItem, aKeys)));
        }
        if (isNaN(Number(sKey))) {
          if (!contains(aKeys, sKey)) {
            _nCode += 1;
            aKey = [];
            aKey.push(_getSpecialKey(_numberToKey(_nCode)), sKey);
            aKeys.push(aKey);
          }
        }
      }
    }
    return aKeys;
  }
function _getKeys(json, aKeys) {
    var aKey,
      sKey,
      oItem;

    for (sKey in json) {

      if (json.hasOwnProperty(sKey)) {
        oItem = json[sKey];
        if (_isObject(oItem) || _isArray(oItem)) {
          aKeys = aKeys.concat(unique(_getKeys(oItem, aKeys)));
        }
        if (isNaN(Number(sKey))) {
          if (!contains(aKeys, sKey)) {
            _nCode += 1;
            aKey = [];
            aKey.push(_getSpecialKey(_numberToKey(_nCode)), sKey);
            aKeys.push(aKey);
          }
        }
      }
    }
    return aKeys;
  }
function _getKeys ( json , aKeys ) { var aKey , sKey , oItem ; for ( sKey in json ) { if ( json . hasOwnProperty ( sKey ) ) { oItem = json [ sKey ] ; if ( _isObject ( oItem ) || _isArray ( oItem ) ) { aKeys = aKeys . concat ( unique ( _getKeys ( oItem , aKeys ) ) ) ; } if ( isNaN ( Number ( sKey ) ) ) { if ( ! contains ( aKeys , sKey ) ) { _nCode += 1 ; aKey = [ ] ; aKey . push ( _getSpecialKey ( _numberToKey ( _nCode ) ) , sKey ) ; aKeys . push ( aKey ) ; } } } } return aKeys ; }
Traverse all the objects looking for keys and set an array with the new keys
@param json
@param aKeys
@returns {*}
@private
Traverse all the objects looking for keys and set an array with the new keys