商品查询修改
This commit is contained in:
@@ -3,6 +3,7 @@ package com.chaozhanggui.system.cashierservice.util;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.fastjson.TypeReference;
|
||||
import com.alibaba.fastjson.serializer.SerializeConfig;
|
||||
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||
|
||||
@@ -117,7 +118,7 @@ public class JSONUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转为JSON对象,注意数组类型会抛异常[{name:\"Stone\"}]
|
||||
* 字符串转为JSON对象,注意数组类型会抛异常[{name:"Stone"}]
|
||||
* (假设json字符串多了某个字段,可能是新加上去的,显然转换成JSONObject时会有这个字段,因为JSONObject就相当于map)
|
||||
*
|
||||
* @param jsonStr 传入的JSON字串
|
||||
@@ -133,7 +134,7 @@ public class JSONUtil {
|
||||
}
|
||||
|
||||
/**
|
||||
* 字符串转为JSON数组,注意对象类型,非数组的会抛异常{name:\"Stone\"}
|
||||
* 字符串转为JSON数组,注意对象类型,非数组的会抛异常{name:"Stone"}
|
||||
* (假设json字符串多了某个字段,可能是新加上去的,显然转换成JSONArray时,其元素会有这个字段,因为JSONArray的元素JSONObject就相当于map)
|
||||
*
|
||||
* @param jsonStr 传入的JSON字串
|
||||
@@ -166,6 +167,12 @@ public class JSONUtil {
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String sss = "{\"bizData\":{\"amount\":1,\"currency\":\"cny\",\"ifCode\":\"sxfpay\",\"mchOrderNo\":\"CZ1715744291232\",\"mercNo\":\"B240510702030\",\"note\":\"等待用户付款\",\"payOrderId\":\"O1790587460614225921\",\"payType\":\"WECHAT\",\"settlementType\":\"D1\",\"state\":\"TRADE_AWAIT\",\"storeId\":\"S2405103298\",\"subject\":\"测试支付\",\"tradeFee\":0},\"code\":\"000000\",\"msg\":\"请求成功\",\"sign\":\"40710a3c293eeac3c7f4a1b0696a2bf6\",\"signType\":\"MD5\",\"timestamp\":\"20240515113813\"}";
|
||||
// TypeReference<PublicResp<MainScanResp>> typeRef = new TypeReference<PublicResp<MainScanResp>>(){};
|
||||
// PublicResp<MainScanResp> response = JSON.parseObject(sss, typeRef);
|
||||
System.out.println("pm");
|
||||
}
|
||||
/**
|
||||
* 字符串转为某个类的列表
|
||||
* (日期字段不管是时间戳形式还是yyyy-MM-dd HH:mm:ss的形式都能成功转换)
|
||||
|
||||
Reference in New Issue
Block a user