code: public Writer write(Writer writer) throws JSONException {
          try {
              boolean notFirst = false;
              writer.write('{');
              for(Iterator it = myHashMap.entrySet().iterator(); it.hasNext();) {
                  Map.Entry entry = (Entry)it.next();
                  if (notFirst) {
                      writer.write(',');
                  }
                  writeQuoted(writer, entry.getKey());
                  writer.write(':');
                  writeValue(writer, entry.getValue());
                  notFirst = true;
              }
              writer.write('}');
              return writer;
          } catch (IOException e) {
              throw new JSONException(e);
          }
      }
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