hujun8610 commented on issue #3676: URL: https://github.com/apache/shenyu/issues/3676#issuecomment-1214975115
@impactCn Someone has found the issue,I found it in `https://github.com/google/gson/pull/1290`,gson has solve the problem. I solve it using the following code ``` private static final Gson GSON = new GsonBuilder() .registerTypeAdapter(String.class, new StringTypeAdapter()) .registerTypeHierarchyAdapter(Pair.class, new PairTypeAdapter()) .registerTypeHierarchyAdapter(Duration.class, new DurationTypeAdapter()) .setObjectToNumberStrategy(ToNumberPolicy.LONG_OR_DOUBLE) // new code .create(); ``` when the ToNumberPolicy is LONG_OR_DOUBLE, it means gson will try to parse a number as a Long, otherwise then try to parse it as a Double, if the number cannot be parsed as a Long. Hope to help you,thanks! -- 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
