FeatureRequest: Deserialize null to empty collection
See original GitHub issueHe there,
Hi there, what to you think about adding the possibility to map null values to empty collections?
If I have a object
// pseudo code
class Person {
String name
List<String> nicknames = new ArrayList()
}
and a json
{
"name": "jackson",
"nicknames": null
}
it would be cool to get an instance where the nicknames collection is empty instead of null
assert person.nicknames.size() == 0
Best regards, Leif
Issue Analytics
- State:
- Created 10 years ago
- Reactions:39
- Comments:21 (8 by maintainers)
Top Results From Across the Web
Jackson deserializer - change null collection to empty one
So few questions: Is there some jackson property that changes null to empty collection during deserialization? If no for the first point -...
Read more >How to remove null/empty JSON nodes from a request body?
The script converts the body to a JSON object and then walks through it recursively and removes fields that have null, empty array...
Read more >Set deserialized grid state in OnStateInit handler cause error ...
Reason: FilterDescriptors property MemberType = null. Note: Method TelerikGrid.SetState() works correctly.
Read more >Something like Serializable that allows null? - Unity Forum
// Values are populated upon deserialization... Thanks... public class ItemBundleProperties. {. public string ...
Read more >Describing Parameters - Swagger
Query parameters can be primitive values, arrays and objects. OpenAPI 3.0 provides several ways to serialize objects and arrays in the query string....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
+1 …nulls are really evil!
+1 Would the best way to do it be a DeserializationFeature? For example DeserializationFeature.READ_NULL_ARRAY_AS_EMPTY_COLLECTION ?