#include "JsonTestController.h" #include void JsonTestController::asyncHandleHttpRequest( const HttpRequestPtr &req, std::function &&callback) { Json::Value json; json["path"] = "json"; json["name"] = "json test"; Json::Value array; for (int i = 0; i < 5; ++i) { Json::Value user; user["id"] = i; user["name"] = "none"; user["c_name"] = "张三"; array.append(user); } json["rows"] = array; auto resp = HttpResponse::newHttpJsonResponse(json); assert(resp->jsonObject().get()); callback(resp); }