Project

General

Profile

Task #28729

Add JSON marshaling support for Optional type to handle null values in API responses

Added by Sachin Divekar 12 days ago. Updated 12 days ago.

Status:
Closed
Priority:
Normal
Target version:
-
Start date:
23/07/2025
Due date:
% Done:

100%

Estimated time:

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.

#1

Updated by Sachin Divekar 12 days ago

  • % 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)
#2

Updated by Sachin Divekar 12 days ago

  • Status changed from In Progress to Closed

Also available in: Atom PDF