code: public String toJSON(boolean bPretty) {
          int indent = bPretty ? 3 : 0;
          JSONEmitter json = new JSONEmitter(indent);
          json.startDocument();
          toJSON(json);
          json.endDocument();
          return json.toString();
      }
docs: Convert the DOM tree rooted at this UNode into a JSON document. Optionally format
  the text with indenting to make it look pretty.
  
  @param   bPretty       True to indent JSON output.
  @return  JSON document for the DOM tree rooted at this UNode.