Uploaded May 2026 | Updated November 2026, 3 days ago
Welcome to our Tebeka Shorts series, episode 56! -- In this video, Miki breaks down the new omitzero JSON flag introduced in Go 1.24. -- Watch now to learn how to replace omitempty with omitzero to cleanly exclude unspecified time values from your output.
For a long time, Go developers have relied on omitempty to keep empty values out of JSON payloads and save bytes. However, omitempty falls short when dealing with structs like time.Time, as Go does not inherently consider these zero-value structs to be "empty". Using a practical LogQuery example, Miki demonstrates exactly how Go evaluates zero values under the hood by looking for the IsZero() bool function.
Things you will learn in this episode:
- The limitations of omitempty with structs in Go
- How the new omitzero tag works in Go 1.24
- How Go uses the IsZero() method to evaluate zero values for types like time.Time
By utilizing this feature, developers can significantly reduce payload sizes by ensuring that uninitialized time and struct fields are not transmitted. This update provides a more precise and elegant way to manage data serialization in Go applications.
----
Comment below or tweet us on twitter & let us know your thoughts, we want to hear from you! ~ If you found this video helpful, hit that like button & subscribe for more content like this.
----
Access our online courses → ardanlabs.com/education
Attending a live training → ardanlabs.com/live-training-events
Other Links:
Website: ardanlabs.com
Github: github.com/ardanlabs
X: twitter.com/ardanlabs
LinkedIn: linkedin.com/ardanlabs
#golang #json #programming #softwareengineering #golangtutorial
Welcome to our Tebeka Shorts series, episode 56! -- In this video, Miki breaks down the new omitzero JSON flag introduced in Go 1.24. -- Watch now to learn how to replace omitempty with omitzero to cleanly exclude unspecified time values from your output.
For a long time, Go developers have relied on omitempty to keep empty values out of JSON payloads and save bytes. However, omitempty falls short when dealing with structs like time.Time, as Go does not inherently consider these zero-value structs to be "empty". Using a practical LogQuery example, Miki demonstrates exactly how Go evaluates zero values under the hood by looking for the IsZero() bool function.
Things you will learn in this episode:
- The limitations of omitempty with structs in Go
- How the new omitzero tag works in Go 1.24
- How Go uses the IsZero() method to evaluate zero values for types like time.Time
By utilizing this feature, developers can significantly reduce payload sizes by ensuring that uninitialized time and struct fields are not transmitted. This update provides a more precise and elegant way to manage data serialization in Go applications.
----
Comment below or tweet us on twitter & let us know your thoughts, we want to hear from you! ~ If you found this video helpful, hit that like button & subscribe for more content like this.
----
Access our online courses → ardanlabs.com/education
Attending a live training → ardanlabs.com/live-training-events
Other Links:
Website: ardanlabs.com
Github: github.com/ardanlabs
X: twitter.com/ardanlabs
LinkedIn: linkedin.com/ardanlabs
#golang #json #programming #softwareengineering #golangtutorial










