private void writeList(Writer writer, List<Object> values) {
    // for each object we clear out the serializedObjects recursion map so that
    // we don't immediately see "duplicate" entries
    serializedObjects.clear();

    try {
      writer.write('[');
      boolean addComma = false;
      int length = values.size();

      if (length == 0) {
        mapper.writeValue(writer, null);
      } else {
        for (Object value : values) {
          if (addComma) {
            writer.write(',');
          }

          mapper.writerFor(value.getClass()).writeValue(writer, value);
          addComma = true;
        }
      }

      writer.write(']');
    } catch (IOException e) {
      throw new UncheckedIOException(e);
    }
  }
After instantiating a formatter add the objects you want to be formatted using this method.
Typically this will be add("result", queryResult)
geode-core/src/main/java/org/apache/geode/management/internal/json/QueryResultFormatter.java