src/jPretty.js
function pJson(events, top = '') {
    Object.keys(events).forEach((i) => {
      if (typeof events[i] === 'object' && events[i] != null) {
        let rtn;
        if (Object.prototype.toString.call(events) === '[object Array]') {
          rtn = (`${top}[${i}]`);
        } else { rtn = (`${top}.${i}`); }
          pJson(events[i], rtn);
      } else if (Object.prototype.toString.call(events) === '[object Array]') {
        tmp += `{}${top}[${i}] = ${events[i]}\n`;
      } else {
        tmp += `{}${top}.${i} = ${events[i]}\n`;
      }
    });
  }
function pJson(events, top = '') {
    Object.keys(events).forEach((i) => {
      if (typeof events[i] === 'object' && events[i] != null) {
        let rtn;
        if (Object.prototype.toString.call(events) === '[object Array]') {
          rtn = (`${top}[${i}]`);
        } else { rtn = (`${top}.${i}`); }
          pJson(events[i], rtn);
      } else if (Object.prototype.toString.call(events) === '[object Array]') {
        tmp += `{}${top}[${i}] = ${events[i]}\n`;
      } else {
        tmp += `{}${top}.${i} = ${events[i]}\n`;
      }
    });
  }
function pJson ( events , top = '' ) { Object . keys ( events ) . forEach ( ( i ) => { if ( typeof events [ i ] === 'object' && events [ i ] != null ) { let rtn ; if ( Object . prototype . toString . call ( events ) === '[object Array]' ) { rtn = ( ` ${ top } ${ i } ` ) ; } else { rtn = ( ` ${ top } ${ i } ` ) ; } pJson ( events [ i ] , rtn ) ; } else if ( Object . prototype . toString . call ( events ) === '[object Array]' ) { tmp += ` ${ top } ${ i } ${ events [ i ] } \n ` ; } else { tmp += ` ${ top } ${ i } ${ events [ i ] } \n ` ; } } ) ; }
json needs to arrive stringified
json needs to arrive stringified