diff --git a/Source/cmVSSetupHelper.cxx b/Source/cmVSSetupHelper.cxx index 342b4f7b00..a016de674a 100644 --- a/Source/cmVSSetupHelper.cxx +++ b/Source/cmVSSetupHelper.cxx @@ -2,16 +2,17 @@ file LICENSE.rst or https://cmake.org/licensing for details. */ #include "cmVSSetupHelper.h" +#include #include #if !defined(CMAKE_BOOTSTRAP) -# include # include #endif #include "cmsys/Encoding.hxx" #include "cmsys/FStream.hxx" +#include "cmJSONState.h" #include "cmStringAlgorithms.h" #include "cmSystemTools.h" @@ -340,14 +341,10 @@ bool cmVSSetupAPIHelper::EnumerateVSInstancesWithVswhere( } // Parse JSON output and iterate over elements - Json::CharReaderBuilder builder; - auto jsonReader = std::unique_ptr(builder.newCharReader()); Json::Value json; - std::string error; - - if (!jsonReader->parse(json_output.data(), - json_output.data() + json_output.size(), &json, - &error)) { + std::istringstream iss(json_output); + cmJSONState parseState(iss, &json, cmJSONState::StrictMode::Relaxed); + if (!parseState.errors.empty()) { return false; }