Let's say that we have a class that contains only one property:
data class MyClass(val map: Map<String, String?>)
As you can see, map property may contain null values, e.g.:
{
"key1": "value1",
"key2": null
}
Now if I use this instance of adapter to create JSON:
moshi.adapter(MyClass::class.java)
It will skip entries with null values (for the example above it will return a String like this: { "key1": "value1" }). The same thing happens if I add .serializeNulls() to the adapter instance.
Question
How can I force a Moshi adapter to take null into consideration?