MCPcopy Create free account
hub / github.com/davecheney/pub / UnmarshalJSON

Method UnmarshalJSON

activitypub/objects.go:63–77  ·  view source on GitHub ↗
(b []byte)

Source from the content-addressed store, hash-verified

61type StringOrArray []string
62
63func (s *StringOrArray) UnmarshalJSON(b []byte) error {
64 var str string
65 if err := json.Unmarshal(b, &str); err == nil {
66 *s = []string{str}
67 return nil
68 }
69
70 var arr []string
71 if err := json.Unmarshal(b, &arr); err == nil {
72 *s = arr
73 return nil
74 }
75
76 return errors.New("invalid string or array")
77}
78
79type Option struct {
80 Type string `json:"type"`

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected