-
Notifications
You must be signed in to change notification settings - Fork 479
New issue
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, 类对象)无限死循环;[BUG] #383
Comments
问题已经修复,请用2.0.6-SNAPSHOT版本验证,2.0.6正式版预计6月5日前发布。需要显示使用 JSONReader.Feature.AllowUnQuotedFieldNames String str = "[{id:'1',name:'Dean',age:32,entryDate:'2016-06-29 22:23:00'},{id:'2',name:'Yang',age:31}]";
{
List<Employee> employees = JSON.parseArray(str, Employee.class, JSONReader.Feature.AllowUnQuotedFieldNames);
assertEquals(2, employees.size());
}
byte[] utf8 = str.getBytes(StandardCharsets.UTF_8);
{
List<Employee> employees = JSON.parseArray(utf8, Employee.class, JSONReader.Feature.AllowUnQuotedFieldNames);
assertEquals(2, employees.size());
}
{
List<Employee> employees = JSON.parseArray(utf8, 0, utf8.length, StandardCharsets.US_ASCII, Employee.class, JSONReader.Feature.AllowUnQuotedFieldNames);
assertEquals(2, employees.size());
}
assertThrows(JSONException.class, () -> JSON.parseArray(str, Employee.class));
assertThrows(JSONException.class, () -> JSON.parseArray(utf8, Employee.class));
assertThrows(JSONException.class, () -> JSON.parseArray(utf8, 0, utf8.length, StandardCharsets.US_ASCII, Employee.class)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
问题描述
简要描述您碰到的问题。
json字符串:[{id:'1',name:'Dean',age:32,entryDate:'2016-06-29 22:23:00'},{id:'2',name:'Yang',age:31}]
java对象:
执行List list = JSON.parseArray(json, Employee.class); 陷入无限死循环。应该是以前的fastjson1支持属性无双引号包裹,但是fastjson2里面json字符串的属性名无双引号用这种就会有上述问题。
环境信息
请填写以下信息:
The text was updated successfully, but these errors were encountered: