Repository navigation
Release 1.8
Null values included in normalization output by default
Breaking change: Normalizer now includes properties with null values in toArray() / toJson() output by default. Previously, null properties were silently omitted.
Before
{"name": "John"}After
{"name": "John", "email": null, "address": null}Opt-out
To preserve the old behavior, use skipNullValues:
$mapper = new Mapper(new MapperOptions(skipNullValues: true));Nested objects
Nested objects with null properties now correctly serialize as a JSON object, not as an empty array:
// Before: {"address": []}
// After: {"address": {"street": null, "city": null}}Changed files
Normalizer—shouldIncludeNull()wired toskipNullValuesMapper— passesMapperOptions::skipNullValuesto Normalizer and TypeResolverTypeResolver/ObjectType— propagates the setting to nested normalizations