fastjson JSONObject.parseObject在不同JDK下执行结果不一致

2lpgd968  于 2021-11-27  发布在  Java
关注(0)|答案(2)|浏览(531)
@Test
public void test() {
	String s1 = "{\"fund_bill_list\":[{\"amount\":\"10.26\",\"fund_channel\":\"ALIPAYACCOUNT\"},{\"amount\":\"1.24\",\"fund_channel\":\"DISCOUNT\",\"real_amount\":\"0.00\"}],\"invoice_amount\":\"10.26\",\"total_amount\":\"11.50\",\"trade_no\":\"2017080421001004040273206391\",\"trade_status\":\"TRADE_SUCCESS\"}";
	JSONObject o = JSONObject.parseObject(s1);
	System.out.println(o.getString("fund_bill_list"));
}

同样一段代码,使用JDK7和JDK8分别运行的结果不一致
使用JDK7运行结果:
[{"amount":"10.26","fund_channel":"ALIPAYACCOUNT"},{"amount":"1.24","fund_channel":"DISCOUNT","real_amount":"0.00"}]

使用JDK8运行结果:
[{"amount":"10.26","fund_channel":"ALIPAYACCOUNT"},{"real_amount":"0.00","amount":"1.24","fund_channel":"DISCOUNT"}]

fastjson版本: 1.2.35

uplii1fm

uplii1fm1#

JSON.parseObject("...", Feature.SortFeidFastMatch);
hk8txs48

hk8txs482#

@wenshao 按这么写JSON.parseObject("...", Feature.SortFeidFastMatch)执行结果还是不一致

并且DEFAULT_PARSER_FEATURE已经包含了Feature.SortFeidFastMatch

相关问题