diff pkg/models/isrs.go @ 1911:6ffc372cde1e

Fixed JSON serialization of ISRS codes.
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Fri, 18 Jan 2019 17:50:25 +0100
parents 6a67cd819e93
children 4a7c2140e44b
line wrap: on
line diff
--- a/pkg/models/isrs.go	Fri Jan 18 17:17:36 2019 +0100
+++ b/pkg/models/isrs.go	Fri Jan 18 17:50:25 2019 +0100
@@ -43,6 +43,13 @@
 	return nil
 }
 
+func (isrs *Isrs) MarshalJSON() ([]byte, error) {
+	if isrs == nil {
+		return nil, nil
+	}
+	return json.Marshal(isrs.String())
+}
+
 // IsrsFromString converts string representation of isrs code to type Isrs
 func IsrsFromString(isrsCode string) (*Isrs, error) {
 	if len(isrsCode) < 20 {