KJB_ROOTLESS_ARRAY -> DJB_ROOTLESS_ARRAY
This commit is contained in:
@@ -14,7 +14,7 @@ import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;
|
||||
@RestControllerAdvice
|
||||
public class ApiResponseAdvice implements ResponseBodyAdvice<Object> {
|
||||
|
||||
static final String KJB_ROOTLESS_ARRAY = "{ \"KJB_ROOTLESS_ARRAY\" : ";
|
||||
private static final String DJB_ROOTLESS_ARRAY = "DJB_ROOTLESS_ARRAY";
|
||||
|
||||
@Override
|
||||
public boolean supports(MethodParameter returnType, Class<? extends HttpMessageConverter<?>> converterType) {
|
||||
@@ -40,8 +40,8 @@ public class ApiResponseAdvice implements ResponseBodyAdvice<Object> {
|
||||
try {
|
||||
Object root = JSONValue.parse(body);
|
||||
|
||||
if (root instanceof JSONObject && ((JSONObject) root).containsKey("KJB_ROOTLESS_ARRAY")) {
|
||||
JSONArray jsonArray = (JSONArray) ((JSONObject) root).get("KJB_ROOTLESS_ARRAY");
|
||||
if (root instanceof JSONObject && ((JSONObject) root).containsKey(DJB_ROOTLESS_ARRAY)) {
|
||||
JSONArray jsonArray = (JSONArray) ((JSONObject) root).get(DJB_ROOTLESS_ARRAY);
|
||||
return jsonArray.toJSONString();
|
||||
} else {
|
||||
return body;
|
||||
|
||||
Reference in New Issue
Block a user