I recently replaced Moshi for Gson in a backend that's expected to serialize responses with nullable values as { "value": null }
, instead of {}
.
Neither Moshi nor Gson do this by default, but Gson has an option to do it directly in the builder:
Gson gson = new GsonBuilder().serializeNulls().create()
.
Does Moshi have support for something similar?