json-date-iso8601-marshaler

command module
v0.0.0-...-888ff2b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 11, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

README

JSON / Date (ISO 8601) Marshal/Unmarshal Example

The goal of this example is to show how to marshal/unmarshal a time.Time value as part of a JSON record and to ensure it is stored in ISO-8601 (~aka RFC 3339) format using UTC time (aka Zulu).

The solution includes declaring a new type, Timestamp and then implementing MarshalText() on that type. The Timestamp also implements Stringer as a convenience and a constructor method Now()

As time.Time's UnmarshalText(), as well as UnmarshalJSON(), expect RFC 3339 format the underlying time.Time methods work with out extension.

To demonstrate the code:

> go test

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL