MCPcopy Create free account
hub / github.com/Kitware/CMake / ReadJson

Function ReadJson

Source/cmStringCommand.cxx:909–922  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

907}
908
909Json::Value ReadJson(std::string const& jsonstr)
910{
911 Json::CharReaderBuilder builder;
912 builder["collectComments"] = false;
913 auto jsonReader = std::unique_ptr<Json::CharReader>(builder.newCharReader());
914 Json::Value json;
915 std::string error;
916 if (!jsonReader->parse(jsonstr.data(), jsonstr.data() + jsonstr.size(),
917 &json, &error)) {
918 throw json_error(
919 cmStrCat("failed parsing json string:\n"_s, jsonstr, '\n', error));
920 }
921 return json;
922}
923std::string WriteJson(Json::Value const& value)
924{
925 Json::StreamWriterBuilder writer;

Callers 1

HandleJSONCommandFunction · 0.70

Calls 6

json_errorClass · 0.85
newCharReaderMethod · 0.80
cmStrCatFunction · 0.70
parseMethod · 0.45
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…