This commit is contained in:
cho
2026-01-15 15:51:03 +09:00
parent 8b30276c6b
commit 5712405a24
@@ -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;
}