-
Notifications
You must be signed in to change notification settings - Fork 110
Open
Description
I've got a Java object containing many nested objects. When I serialize this object the response get large. There currently is a "omitDefaults" parameter, but this also removes booleans which are false and ints which are 0. In my scenario I can't remove these.
As far as I can see from the documentation, I'm using version 2.0.2, the way to remove only null objects is currently to write a serializer manually. For nested object graphs this would be very tedious and potentially error prone.
It would therefore be nice to have a way to configure whether you want null objects included during serialization, or not.
E.g: @CompiledJson(skipNulls = true)
and also maybe @JsonAttribute(skipNull = true)
for finer control.
From this:
{
"nin": "123456",
"hasAny": false,
"hasActive": false,
"count": 0,
"lastChangedDateTime": null,
"dateChanged": {
"allergyIntoleranceDate": null,
"conditionComplicationsOfAnesthesiaDate": null,
"conditionCriticalMedicalConditionDate": null,
"procedureDate": null,
"deviceUseStatementDate": null,
"conditionTransplantsAndOtherForeignBodiesDate": null,
"consentDate": null,
"flagDate": null,
"conditionInfectionDate": null
},
"status": {
"allergyIntoleranceDrugReaction": null,
"allergyIntoleranceOtherAllergen": null,
"conditionTransplantsAndOtherForeignBodies": null,
"conditionOtherProblemWithAnesthesia": null,
"conditionCriticalMedicalCondition": null,
"conditionIntubationProblem": null,
"conditionInfection": null,
"consent": null,
"deviceUseStatement": null,
"procedure": null,
"flag": null
},
"privacySetting": {
"hasReservation": false,
"isRestricted": false,
"isBlocked": false
}
}
To this:
{
"nin": "123456",
"hasAny": false,
"hasActive": false,
"count": 0,
"dateChanged": {},
"status": {},
"privacySetting": {
"hasReservation": false,
"isRestricted": false,
"isBlocked": false
}
}
Metadata
Metadata
Assignees
Labels
No labels