github.com/inazumav/sing-box@v0.0.0-20230926072359-ab51429a14f1/common/badversion/version_json.go (about) 1 package badversion 2 3 import "github.com/inazumav/sing-box/common/json" 4 5 func (v Version) MarshalJSON() ([]byte, error) { 6 return json.Marshal(v.String()) 7 } 8 9 func (v *Version) UnmarshalJSON(data []byte) error { 10 var version string 11 err := json.Unmarshal(data, &version) 12 if err != nil { 13 return err 14 } 15 *v = Parse(version) 16 return nil 17 }