Convert the object of the class to JSON and return it

code directly

// call interface method
ApiResp resp = service.action(from);
// no data output empty
resp = resp == null ? new ApiResp(from) : resp;
		
// debug log
if (ApiUtils.DEBUG) {
	log.info("API DEBUG ACTION \n[from=" + from + "]" //
		+ "\n[resp=" + JsonKit.toJson(resp) + "]" //
		+ "\n[time=" + (System.currentTimeMillis() - start) + "ms]");
}	
renderJson("001,1002"+JsonKit.toJson(resp));

import:

import com.jfinal.kit.JsonKit;

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326045728&siteId=291194637