code: protected void write(Writer writer, WritingVisitor visitor) throws IOException {
        if( isNullObject() ){
           writer.write(JSONNull.getInstance().toString());
        }
  
        boolean b = false;
        Iterator keys = visitor.keySet(this).iterator();
        writer.write('{');
  
        while( keys.hasNext() ){
           if( b ){
              writer.write(',');
           }
           Object k = keys.next();
           writer.write(JSONUtils.quote(k.toString()));
           writer.write(':');
           Object v = this.properties.get(k);
           if( v instanceof JSON ){
              visitor.on((JSON) v, writer);
           }else{
              visitor.on(v, writer);
           }
           b = true;
        }
        writer.write('}');
     }
docs: Write the contents of the JSONObject as JSON text to a writer. For
  compactness, no whitespace is added.
  <p>
  Warning: This method assumes that the data structure is acyclical.
  
  @return The writer.
  @throws JSONException