From c85972a808a918dc434255c093b6dff5777683c7 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Mon, 19 Dec 2022 21:06:45 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8Djsonpath=E6=96=AD=E8=A8=80=E5=88=A4=E6=96=ADn?= =?UTF-8?q?ull=E5=80=BC=E5=A4=B1=E8=B4=A5=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1019569 --user=王孝刚 [接口测试]github#19637jsonpath断言,响应体中字段为null的值识别不到,导致断言失败 https://www.tapd.cn/55049933/s/1317177 --- .../src/main/java/io/metersphere/utils/DocumentUtils.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/sdk-parent/jmeter/src/main/java/io/metersphere/utils/DocumentUtils.java b/framework/sdk-parent/jmeter/src/main/java/io/metersphere/utils/DocumentUtils.java index d4f8384290..2aed6d5fb9 100644 --- a/framework/sdk-parent/jmeter/src/main/java/io/metersphere/utils/DocumentUtils.java +++ b/framework/sdk-parent/jmeter/src/main/java/io/metersphere/utils/DocumentUtils.java @@ -1,6 +1,6 @@ package io.metersphere.utils; -import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import io.metersphere.vo.Condition; import io.metersphere.vo.ElementCondition; import net.minidev.json.JSONArray; @@ -106,7 +106,7 @@ public class DocumentUtils { if (subj == null) { str = "null"; } else if (subj instanceof Map) { - str = new Gson().toJson(subj); + str = new GsonBuilder().serializeNulls().create().toJson(subj); } else if (!(subj instanceof Double) && !(subj instanceof Float)) { str = subj.toString(); } else {