fastjson Error in deserialization:StackOverflow

6yjfywim  于 2022-11-13  发布在  其他
关注(0)|答案(1)|浏览(196)

My Object like this:
@DaTa
@builder
@NoArgsConstructor
@AllArgsConstructor
public class TestResult {
private List<Map.Entry<String, Double>> dps;
}

and my jsontext is :
[
{
"dps": {
"1557936000": 1893.0,
"1558022400": 0.0
}
},
{
"dps": {
"1557936000": 954.0,
"1558022400": 0.0
}
}
]
when i use JSON.parseArray(jsontext , TestResult .class) then stackoverflow!

when i change
private List<Map.Entry<String, Double>> dps; to private List<Map.Entry> dps;
the result is ok

but i found that the type of value is bigdecimal

c0vxltue

c0vxltue1#

According to your definition of TestResult , your input jsontext does not match TestResult array. Your jsontext should be like this:

[{
	"dps": [{
		"1557936000": 1893.0
	}, {
		"1558022400": 0.0
	}]
}, {
	"dps": [{
		"1557936000": 954.0
	}, {
		"1558022400": 0.0
	}]
}]

相关问题