Task #28729
Add JSON marshaling support for Optional type to handle null values in API responses
Added by Sachin Divekar 14 days ago.
Updated 14 days ago.
Description
Implements proper JSON marshaling so Optional
fields serialize correctly i.e. explicit null values -> JSON null, present values -> actual values and absent fields -> omitted with struct tags.
- % Done changed from 0 to 100
- Status changed from New to In Progress
Currently, Optional
fields in API responses serialize as complex objects exposing internal structure (Value, Present, Null fields). This ticket implements proper JSON marshaling so Optional
fields serialize correctly:
- Explicit null values -> JSON null
- Present values -> actual values
- Absent fields -> zero values (or omitted with Go 1.24+ omitzero tag)
- Status changed from In Progress to Closed
Also available in: Atom
PDF