openrtb-core/src/main/java/com/google/openrtb/json/OpenRtbNativeJsonWriter.java
public final void writeNativeRequest(NativeRequest req, JsonGenerator gen) throws IOException {
    gen.writeStartObject();
    if (factory().isRootNativeField()) {
      gen.writeObjectFieldStart("native");
    }
    writeNativeRequestFields(req, gen);
    writeExtensions(req, gen);
    if (factory().isRootNativeField()) {
      gen.writeEndObject();
    }
    gen.writeEndObject();
    gen.flush();
  }
public final void writeNativeRequest(NativeRequest req, JsonGenerator gen) throws IOException {
    gen.writeStartObject();
    if (factory().isRootNativeField()) {
      gen.writeObjectFieldStart("native");
    }
    writeNativeRequestFields(req, gen);
    writeExtensions(req, gen);
    if (factory().isRootNativeField()) {
      gen.writeEndObject();
    }
    gen.writeEndObject();
    gen.flush();
  }
Serializes a {@link NativeRequest} to JSON, with a provided {@link JsonGenerator}
which allows several choices of output and encoding.