We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用JSON.parseArray 反序列化非数组json("{....}"), 不论传入Class是什么类型,均转换为List 内部String元素为改json字符串 涉及api: com.alibaba.fastjson2.JSON#parseArray(java.lang.String, java.lang.Class)
如何操作可以重现该问题:
import java.util.List; import java.util.Objects; import java.util.stream.Collectors; import org.assertj.core.api.Assertions; import org.junit.Test; public class JsonArrayParseTest { @Test public void name() { String json = "{\"scene\":\"abc\",\"expireTime\":2880}"; List<?> ls = com.alibaba.fastjson2.JSON.parseArray(json, Bean.class); System.out.println(ls.stream().map(Object::getClass).collect(Collectors.toList())); System.out.println(ls.stream().map(Objects::toString).collect(Collectors.toList())); Assertions.assertThatThrownBy(() -> com.alibaba.fastjson.JSON.parseArray(json, Bean.class)); } private static class Bean { private String scene; private int expireTime; public String getScene() { return scene; } public void setScene(String scene) { this.scene = scene; } public int getExpireTime() { return expireTime; } public void setExpireTime(int expireTime) { this.expireTime = expireTime; } } }
如FastJson1那样报错。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
问题描述
使用JSON.parseArray 反序列化非数组json("{....}"), 不论传入Class是什么类型,均转换为List 内部String元素为改json字符串
涉及api:
com.alibaba.fastjson2.JSON#parseArray(java.lang.String, java.lang.Class)
环境信息
重现步骤
如何操作可以重现该问题:
期待的正确结果
如FastJson1那样报错。
The text was updated successfully, but these errors were encountered: