code: public void serialize(List<T> list, JsonGenerator jsonGenerator) throws IOException {
          jsonGenerator.writeStartArray();
          for (T object : list) {
              if (object != null) {
                  serialize(object, jsonGenerator, true);
              } else {
                  jsonGenerator.writeNull();
              }
          }
          jsonGenerator.writeEndArray();
      }
docs: Serialize a list of objects to a JsonGenerator.
  
  @param list The list of objects to serialize.
  @param jsonGenerator The JsonGenerator to which the list should be serialized