From cb92be844edc4e957aba811fd2dd2d8e048a0753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=99=BD=E8=8C=B6=E6=B8=85=E6=AC=A2?= Date: Mon, 25 Nov 2024 18:54:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96json=E5=90=88=E5=B9=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- json.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/json.go b/json.go index ee6f6c1..0fdb977 100644 --- a/json.go +++ b/json.go @@ -181,7 +181,13 @@ func (oj *ownJSON) MergeDataForMap(ignoreError bool, dataList ...any) (map[strin } for k, v := range itemRes { - res[k] = v + if v == nil { + if _, exist := res[k]; !exist { + res[k] = v + } + } else { + res[k] = v + } } } return res, nil