Skip to content

Instantly share code, notes, and snippets.

@nikolaydubina
Created November 22, 2024 03:18
Show Gist options
  • Save nikolaydubina/f745b60a7a81f12785e0108e5f7dc190 to your computer and use it in GitHub Desktop.
Save nikolaydubina/f745b60a7a81f12785e0108e5f7dc190 to your computer and use it in GitHub Desktop.
// yes
package main
import (
"encoding/json"
"fmt"
"time"
)
type S struct {
T time.Time `json:"ts,omitempty"`
}
func main() {
var s S
b, _ := json.Marshal(s)
fmt.Println(string(b))
// Output: {"ts":"0001-01-01T00:00:00Z"}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment