jsoncpp1.9.4源码解析
CharReaderBuilder
默认的设置:
void CharReaderBuilder::setDefaults(Json::Value* settings) {
(*settings)["collectComments"] = true; // 解析和序列化的时候是否保留注释
(*settings)["allowComments"] = true; // 是否允许注释
(*settings)["allowTrailingCommas"] = true; //
(*settings)["strictRoot"] = false; // 根是否只能为array或者object
(*settings)["allowDroppedNullPlaceholders"] = false; //
(*settings)["allowNumericKeys"] = false; // 是否允许数字作为key
(*settings)["allowSingleQuotes"] = false; // 是否允许单引号
(*settings)["stackLimit"] = 1000; // json嵌套层数
(*settings)["failIfExtra"] = false; // jsonvalue后面有非空白符时parse是否失败
(*settings)["rejectDupKeys"] = false; // 是否拒绝object中重复的key
(*settings)["allowSpecialFloats"] = false; // 是否允许特殊浮点数(NaN,Inf)
(*settings)["skipBom"] = true; //
}
StreamWriterBuilder
默认的设置:
void StreamWriterBuilder::setDefaults(Json::Value* settings) {
(*settings)["commentStyle"] = "All";
(*settings)["indentation"] = "\t";
(*settings)["enableYAMLCompatibility"] = false;
(*settings)["dropNullPlaceholders"] = false;
(*settings)["useSpecialFloats"] = false;
(*settings)["emitUTF8"] = false;
(*settings)["precision"] = 17;
(*settings)["precisionType"] = "significant";
}