From 8b9e4eeead8717974d34839c7b32cf9324b860db Mon Sep 17 00:00:00 2001 From: Paul Duncan Date: Sat, 19 Mar 2022 07:42:10 -0400 Subject: feed: add MarshalJSON for several types --- feed/cveid.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'feed/cveid.go') diff --git a/feed/cveid.go b/feed/cveid.go index 5e43ad3..d7d9a32 100644 --- a/feed/cveid.go +++ b/feed/cveid.go @@ -75,6 +75,11 @@ func NewCveId(s string) (CveId, error) { return CveId(encodeCveId(year, num)), nil } +// Marshal CVE ID to JSON. +func (me CveId) MarshalJSON() ([]byte, error) { + return json.Marshal(me.String()) +} + // Unmarshal CVE ID from JSON. func (me *CveId) UnmarshalJSON(b []byte) error { // decode string, check for error -- cgit v1.2.3