goson

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

README

GOSON

goson is a json marshal/unmarshal tool with function

Useage

  • you can use it like json.Marshal
    goson.Marshal()
  • and json.Unmarshal
    goson.Unmarshal
  • you can use set/get value on marshal/unmarshal
type Example struct {
    version              string       `json:"version"`
}

func (t *Example) SetVersion(version string) {
    t.version = version
}

func (t Example) Version() string {
    return t.version
}
  • and you can define the custom function to set/get value on marshal/unmarshal
type Example struct {
    version              string       `json:"version" json-getter:"Version" json-setter:"SetMyVersion"`
}


func (t *Example) SetMyVersion(version string) {
    t.version = version
}

func (t Example) Version() string {
    return t.version
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MarshalJSON

func MarshalJSON(v interface{}) ([]byte, error)

func UnmarshalJSON

func UnmarshalJSON(data []byte, v interface{}) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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