From 8f5f28614caaee6df9b9c14972a7f9e3ef7bb8a0 Mon Sep 17 00:00:00 2001 From: Masaaki Goshima Date: Mon, 30 Aug 2021 11:39:27 +0900 Subject: [PATCH] Add test case --- decode_test.go | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/decode_test.go b/decode_test.go index f52069b..4b6dcc0 100644 --- a/decode_test.go +++ b/decode_test.go @@ -3732,3 +3732,46 @@ func TestDecodeBinaryTypeWithEscapedChar(t *testing.T) { } }) } + +func TestIssue282(t *testing.T) { + var J = []byte(`{ + "a": {}, + "b": {}, + "c": {}, + "d": {}, + "e": {}, + "f": {}, + "g": {}, + "h": { + "m": "1" + }, + "i": {} +}`) + + type T4 struct { + F0 string + F1 string + F2 string + F3 string + F4 string + F5 string + F6 int + } + type T3 struct { + F0 string + F1 T4 + } + type T2 struct { + F0 string `json:"m"` + F1 T3 + } + type T0 map[string]T2 + + var v T0 + if err := json.Unmarshal(J, &v); err != nil { + t.Fatal(err) + } + if v["h"].F0 != "1" { + t.Fatalf("failed to assign map value") + } +}