2
0

Add UnmarshalJSON to a few types

This commit is contained in:
Jack Christensen
2017-09-29 15:25:53 -05:00
parent f71bf5db91
commit 63f58fd32e
3 changed files with 29 additions and 0 deletions
+12
View File
@@ -149,3 +149,15 @@ func (src *Text) MarshalJSON() ([]byte, error) {
return nil, errBadStatus
}
func (dst *Text) UnmarshalJSON(b []byte) error {
var s string
err := json.Unmarshal(b, &s)
if err != nil {
return err
}
*dst = Text{String: s, Status: Present}
return nil
}