hujun8610 commented on issue #3676:
URL: https://github.com/apache/shenyu/issues/3676#issuecomment-1214131197
I reproduced the issue with the following code
```
String testJson =
"[{\"params\":{\"date\":{\"intervalDay\":0},\"domain\":\"weather\",\"showDay\":\"今天\"}}]";
List<Object> testList =
GsonUtils.getInstance().fromList(testJson,Object.class);
System.out.println(testList);
```
In this code, I use `Object.class` to serialize the json string, the result
is as follows:
`[{params={date={intervalDay=0.0}, domain=weather, showDay=今天}}]`
But when I defined a class to match the json String, the issue disappear.
The code
```
static class TestParams{
Params params;
static class Params{
private String domain;
private String showDay;
private Map<String,Integer> date;
}
// setter and getter
```
TestClass
```
String testJson =
"[{\"params\":{\"date\":{\"intervalDay\":0},\"domain\":\"weather\",\"showDay\":\"今天\"}}]";
List<TestParams> testList =
GsonUtils.getInstance().fromList(testJson,TestParams.class);
assertEquals(testList.get(0).getParams().getDate().get("intervalDay"),0);
```
I think the issue may be related to `gson` configuration.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscr...@shenyu.apache.org
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org