수정
This commit is contained in:
@@ -37,15 +37,16 @@ public class ApiResponseAdvice implements ResponseBodyAdvice<Object> {
|
||||
|
||||
String removeRootlessArrayKeyFormResponseBody(String body) {
|
||||
|
||||
if (body.startsWith(KJB_ROOTLESS_ARRAY)) {
|
||||
body = body.substring(KJB_ROOTLESS_ARRAY.length());
|
||||
try {
|
||||
Object root = JSONValue.parse(body);
|
||||
|
||||
if (body.endsWith("}")) {
|
||||
body = body.substring(0, body.length() - 1);
|
||||
if (root instanceof JSONObject && ((JSONObject) root).containsKey("KJB_ROOTLESS_ARRAY")) {
|
||||
JSONArray jsonArray = (JSONArray) ((JSONObject) root).get("KJB_ROOTLESS_ARRAY");
|
||||
return jsonArray.toJSONString();
|
||||
} else {
|
||||
return body;
|
||||
}
|
||||
|
||||
return body;
|
||||
} else {
|
||||
} catch (Exception e) {
|
||||
return body;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user