#endif // HAVE_STRCASESTR
-using namespace rapidjson;
-
static Json getServerDetail() {
return Json::object {
{ "type", "Server" },
map<string,string> items;
productServerStatisticsFetch(items);
- Document doc;
- doc.SetArray();
+ Json::array doc;
typedef map<string, string> items_t;
- for(const items_t::value_type& item : items) {
- Value jitem;
- jitem.SetObject();
- jitem.AddMember("type", "StatisticItem", doc.GetAllocator());
-
- Value jname(item.first.c_str(), doc.GetAllocator());
- jitem.AddMember("name", jname, doc.GetAllocator());
-
- Value jvalue(item.second.c_str(), doc.GetAllocator());
- jitem.AddMember("value", jvalue, doc.GetAllocator());
-
- doc.PushBack(jitem, doc.GetAllocator());
+ for(const items_t::value_type& item : items) {
+ doc.push_back(Json::object {
+ { "type", "StatisticItem" },
+ { "name", item.first },
+ { "value", item.second },
+ });
}
resp->setBody(doc);
#define PDNS_WSAPI_HH
#include <map>
-#include "rapidjson/document.h"
-#include "rapidjson/stringbuffer.h"
-#include "rapidjson/writer.h"
#include "webserver.hh"
void apiServer(HttpRequest* req, HttpResponse* resp);