code: private void writeAttributes(Writer writer, Properties attrs, int depth, boolean compact)
      throws IOException
      {
          if (logger.isLoggable(Level.FINER)) logger.entering(className, "writeAttributes(Writer, Properties, int, boolean)");
  
          if (attrs != null)
          {
              Enumeration props = attrs.propertyNames();
  
              if (props != null && props.hasMoreElements())
              {
                  while (props.hasMoreElements())
                  {
                      String prop = (String)props.nextElement();
                      writeAttribute(writer, escapeAttributeNameSpecialCharacters(prop), (String)attrs.get(prop), depth + 1, compact);
                      if (props.hasMoreElements())
                      {
                          try
                          {
                              if (!compact)
                              {
                                  writer.write(",\n");
                              }
                              else
                              {
                                  writer.write(",");
                              }
                          }
                          catch (Exception ex)
                          {
                              IOException iox = new IOException("Error occurred on serialization of JSON text.");
                              iox.initCause(ex);
                              throw iox;
                          }
                      }
                  }
              }
          }
  
          if (logger.isLoggable(Level.FINER)) logger.exiting(className, "writeAttributes(Writer, Properties, int, boolean)");
      }
docs: Internal method to write out a proper JSON attribute string.
  @param writer The writer to use while serializing
  @param attrs The attributes in a properties object to write out
  @param depth How far to indent the JSON text.
  @param compact Whether or not to use pretty indention output, or compact output, format
  @throws IOException Trhown if an error occurs on write.