diff options
Diffstat (limited to 'lib/lowmemjson/encode.go')
-rw-r--r-- | lib/lowmemjson/encode.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/lowmemjson/encode.go b/lib/lowmemjson/encode.go index 1d79e07..ca3d406 100644 --- a/lib/lowmemjson/encode.go +++ b/lib/lowmemjson/encode.go @@ -183,9 +183,11 @@ func encode(w io.Writer, val reflect.Value, quote bool) { } } case reflect.Interface: - // .Kind() will only be reflect.Interface if - // there's no concrete type. - encodeWriteString(w, "null") + if val.IsNil() { + encodeWriteString(w, "null") + } else { + encode(w, val.Elem(), quote) + } case reflect.Struct: encodeWriteByte(w, '{') empty := true |