Categorygithub.com/ynqa/jsoniterx
modulepackage
0.0.0-20201219114039-a1680a0075d9
Repository: https://github.com/ynqa/jsoniterx.git
Documentation: pkg.go.dev

# README

jsoniterx

Extension for json-iterator/go.

Tags

time.Time

Namedescription
formatA string for format. more details.
locationA string for Location.

Example

package main

import (
	"fmt"
	"time"

	jsoniter "github.com/json-iterator/go"

	"github.com/ynqa/jsoniterx"
)

type Example struct {
	Time time.Time `json:"time" format:"2006-01-02 15:04:05" location:"Asia/Tokyo"`
}

func main() {
	json := jsoniter.ConfigCompatibleWithStandardLibrary
	json.RegisterExtension(jsoniterx.TimePlugin())

	var e Example
	str := `{"time": "2019-01-01 12:00:00"}`
	if err := json.Unmarshal([]byte(str), &e); err != nil {
		fmt.Println(err)
		return
	}
	fmt.Println(e.Time)
}

# Packages

No description provided by the author

# Functions

No description provided by the author

# Type aliases

No description provided by the author