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