docling-project / docling-project/docling-java

`@JsonInclude(NON_EMPTY)` makes DoclingDocument serialization lossy

Open
#598 9 comments 1 reaction 2 assignees Claimed by @edeandrea View on GitHub
Dominant language
Java
Stars
134
Forks
26
Avg merge
12h 25m
Merged PRs (30d)
45

Description

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

```java
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](https://github.com/docling-project/docling/issues/3780), [docling-java#386](https://github.com/docling-project/docling-java/issues/386)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.