将类的对象转换成JSON返回

直接上代码

// 调用接口方法
ApiResp resp = service.action(from);
// 没有数据输出空
resp = resp == null ? new ApiResp(from) : resp;
		
// 调试日志
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;

猜你喜欢

转载自blog.csdn.net/blueplus/article/details/80162450
今日推荐