Class DocumentResponse

java.lang.Object
ai.docling.serve.api.convert.response.DocumentResponse

public class DocumentResponse extends Object
A simple mutable POJO representing the converted document returned by the Docling Convert API. The properties map 1:1 to the JSON payload using the JsonProperty names declared on each field.

Serialization is configured with JsonInclude.Include.NON_EMPTY, meaning nulls, empty strings, and empty collections/maps are omitted from the serialized JSON.

Notes on mutability and maps:

  • jsonContent defaults to an empty map and is never exposed as null. The getter returns an unmodifiable view.
  • When setting jsonContent with a non-null map, the reference is preserved; subsequent external modifications to the provided map are observable via getJsonContent().
  • Method Details

    • builder

      public static @NonNull DocumentResponse.Builder builder()
    • toBuilder

      public @NonNull DocumentResponse.Builder toBuilder()
    • getDoctagsContent

      public @Nullable String getDoctagsContent()
      Document content in DocTags format (if requested).
      Returns:
      the DocTags content, or null if not requested
    • getFilename

      public String getFilename()
      Filename of the source document.
      Returns:
      the filename
    • getHtmlContent

      public @Nullable String getHtmlContent()
      Document content in HTML format (if requested).
      Returns:
      the HTML content, or null if not requested
    • getJsonContent

      public @Nullable ai.docling.core.DoclingDocument getJsonContent()
      Document content as DoclingDocument JSON (if requested).
      Returns:
      the JSON content, or null if not requested
    • getMarkdownContent

      public @Nullable String getMarkdownContent()
      Document content in Markdown format (if requested).
      Returns:
      the Markdown content, or null if not requested
    • getTextContent

      public @Nullable String getTextContent()
      Document content as plain text (if requested).
      Returns:
      the text content, or null if not requested
    • toString

      public @NonNull String toString()
      Overrides:
      toString in class Object