From: Christian Hofstaedtler Date: Mon, 28 Dec 2015 12:18:00 +0000 (+0100) Subject: Port zone2sql to json11 X-Git-Tag: dnsdist-1.0.0-alpha2~123^2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7d365ab7c80598d2dcf628d0023699ea1203f49e;p=thirdparty%2Fpdns.git Port zone2sql to json11 --- diff --git a/pdns/zone2sql.cc b/pdns/zone2sql.cc index d95c5f2afc..eefee92525 100644 --- a/pdns/zone2sql.cc +++ b/pdns/zone2sql.cc @@ -30,8 +30,8 @@ #include #include +#include "json11.hpp" #include "namespaces.hh" -#include "json.hh" #include "dns.hh" #include "arguments.hh" #include "bindparserclasses.hh" @@ -156,12 +156,13 @@ static void emitRecord(const string& zoneName, const DNSName &DNSqname, const st string::size_type pos = comment.find("json={"); if(pos!=string::npos) { string json = comment.substr(pos+5); - rapidjson::Document document; - if(document.Parse<0>(json.c_str()).HasParseError()) - throw runtime_error("Could not parse JSON '"+json+"'"); + string err; + auto document = json11::Json::parse(json, err); + if(document.is_null()) + throw runtime_error("Could not parse JSON '"+json+"': " + err); - disabled=boolFromJson(document, "disabled", false); - recordcomment=stringFromJson(document, "comment", ""); + disabled=document["disabled"].bool_value(); + recordcomment=document["comment"].string_value(); } }