google / google/gson

Feature request: Force inclusion of specific field when null

Open
#532 1 comment 3 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
24.2k
Forks
4.5k
Avg merge
6d 4h
Merged PRs (30d)
12

Description

```
Gson allows blanket-inclusion of null fields, using serializeNulls(). But this
produces much bigger JSON output (which is why the default is not to serialize
nulls).

It would be nice to support a per-field annotation, for just those fields where
(broken) clients expect a null to be provided. The alternative is to turn on
serializeNulls everywhere (I think).

Jackson supports this with @JsonInclude(Include.ALWAYS).
```

Original issue reported on code.google.com by `jus...@fathomdb.com` on 26 Aug 2013 at 12:58

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.