FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

修复请求json的key为JSONArray时类型转换异常问题 by DenineLu · Pull Request #808 · APIJSON/APIJSON · GitHub

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .java  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Back | FazBrowse Home | New Git URL