code: public Serializer writeArray(JSONArray value) throws IOException {
          if (null == value) return writeNull();
  
          // write header
          writeRawString("[");
          indentPush();
  
          for (Iterator iter=value.iterator(); iter.hasNext(); )
          {
              Object element = iter.next();
              if (!JSONObject.isValidObject(element)) throw new IOException("attempting to serialize array with an invalid element: '" + value + "'");
  
              newLine();
              indent();
              write(element);
  
              if (iter.hasNext()) writeRawString(",");
          }
  
          // write trailer
          indentPop();
          newLine();
          indent();
          writeRawString("]");
  
          return this;
      }
docs: Method to write a JSON array out to the stream.
  @param value The JSON array to write out.
  @throws IOException Thrown if an error occurs during write.