From 7a3a5f2b480568ff262f05cb0c8a98627d865c55 Mon Sep 17 00:00:00 2001 From: Adam Brykajlo Date: Wed, 16 Mar 2016 13:10:18 -0700 Subject: [PATCH] added JSON check to null --- jsonapi/unmarshal.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsonapi/unmarshal.go b/jsonapi/unmarshal.go index 05f1147..1a8d560 100644 --- a/jsonapi/unmarshal.go +++ b/jsonapi/unmarshal.go @@ -305,7 +305,7 @@ func UnmarshalInto(input map[string]interface{}, targetStructType reflect.Type, if extType := field.Type(); extType != nil && extType.Kind().String() == "struct" { fieldSource := extType.Field(0).Name - if strings.HasPrefix(fieldSource, "null") || strings.HasPrefix(fieldSource, "Null") || strings.HasPrefix(fieldSource, "Zero") || strings.HasPrefix(fieldSource, "Time") { + if strings.HasPrefix(fieldSource, "JSON") || strings.HasPrefix(fieldSource, "null") || strings.HasPrefix(fieldSource, "Null") || strings.HasPrefix(fieldSource, "Zero") || strings.HasPrefix(fieldSource, "Time") { field.Set(reflect.Zero(field.Type())) }