From 704e79dc9a1b2781634a07043f96eb7ec9e51328 Mon Sep 17 00:00:00 2001 From: steden <1470804@qq.com> Date: Thu, 5 Dec 2024 20:49:36 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4json=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- snc/json.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/snc/json.go b/snc/json.go index 28f91bee9..a5029ccc1 100644 --- a/snc/json.go +++ b/snc/json.go @@ -18,9 +18,11 @@ func init() { option.DefaultAstBufferSize = 2 * 1024 snc = sonic.Config{ - CompactMarshaler: true, - UseNumber: true, - CopyString: true, + CompactMarshaler: true, // 输出紧凑json + NoNullSliceOrMap: true, // 空对象编码为:[] {} + UseInt64: true, // 整数对象转换为int64,否则为float64 + UseNumber: true, // 不要转换成float64而是json.number + CopyString: true, // 不要引用字符串,而是复制一份出来 }.Froze() }