Skip to content

修复请求json的key为JSONArray时类型转换异常问题 #808

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

Merged
merged 1 commit into from
Apr 11, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,10 @@ public AbstractObjectParser parse(String name, boolean isReuse) throws Exception
break;
}

String key = entry == null ? null : entry.getKey();
// key可能为JSONArray,需要进行手动转换(fastjson为低版本时允许自动转换,如1.2.21)
// 例如request json为 "{[]:{"page": 2, "table1":{}}}"
Object field = entry == null ? null : entry.getKey();
String key = field instanceof JSONArray ? ((JSONArray) field).toJSONString() : field.toString();
Object value = key == null ? null : entry.getValue();
if (value == null) {
continue;
Expand Down