`@JsonInclude(NON_EMPTY)` makes DoclingDocument serialization lossy

Open
#598 9 comments 1 reaction 2 assignees View on GitHub

@edeandrea is already working on this.

Since Jul 20, 2026.

  • #603 by @copilot-swe-agent — closed without merging

Assessment

This issue has not been assessed yet.

Description

Serve keeps "text": "" on formula items (do_formula_enrichment=false). The Java DoclingDocument still has text as "", but serialization drops it:

DoclingDocument doc = response.getDocument().getJsonContent();
// doc still has text == ""
byte[] bytes = jsonMapper.writeValueAsBytes(doc); // "text" omitted in JSON

Include.ALWAYS on the mapper does not help — class-level @JsonInclude(NON_EMPTY) wins. No raw json_content accessor either.

Wanted: lossless serialize, or raw json_content bytes/JsonNode.

Related: docling#3780, docling-java#386

Dominant language
Java
Stars
136
Forks
26
Avg merge
1d 1h
Merged PRs (30d)
47

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from docling-project/docling-java

All issues in docling-project/docling-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.