From cd6773e6944114ea90406b116767ec1ec1105592 Mon Sep 17 00:00:00 2001 From: allen Date: Sun, 31 May 2020 18:18:48 +0800 Subject: [PATCH] remove quotation check for key when decoding map we don't need to check if the key is surrounded by quotation. In fact, the key might not be strings if we register an extension to customize the map key encoder/decoder.It may be an integer, float, or even a struct. --- reflect_map.go | 4 ---- 1 file changed, 4 deletions(-) diff --git a/reflect_map.go b/reflect_map.go index 13fb67e..5829671 100644 --- a/reflect_map.go +++ b/reflect_map.go @@ -167,10 +167,6 @@ func (decoder *mapDecoder) Decode(ptr unsafe.Pointer, iter *Iterator) { if c == '}' { return } - if c != '"' { - iter.ReportError("ReadMapCB", `expect " after }, but found `+string([]byte{c})) - return - } iter.unreadByte() key := decoder.keyType.UnsafeNew() decoder.keyDecoder.Decode(key, iter)