code: function prettyPrintJson(obj, indent) {
    var result = '';
  
    if (indent == null) indent = '';
  
    for (var property in obj) {
      if (property.charAt(0) !== '_') {
        var value = obj[property];
  
        if (typeof value === 'string') {
          value = '\'' + value + '\'';
        } else if (typeof value === 'object') {
          if (value instanceof Array) {
            value = '[ ' + value + ' ]';
          } else {
            // Recursive dump
            var od = prettyPrintJson(value, indent + '  ');
  
            value = '{\n' + od + '\n' + indent + '}';
          }
        }
        result += indent + property + ': ' + value + ',\n';
      }
    }
    return result.replace(/,\n$/, '');
  }
docs: http://goo.gl/7DbFS