diff --git a/include/jwt-cpp/traits/open-source-parsers-jsoncpp/traits.h b/include/jwt-cpp/traits/open-source-parsers-jsoncpp/traits.h index 0f420a233..5442ba0f8 100644 --- a/include/jwt-cpp/traits/open-source-parsers-jsoncpp/traits.h +++ b/include/jwt-cpp/traits/open-source-parsers-jsoncpp/traits.h @@ -117,8 +117,11 @@ namespace jwt { } static bool parse(value_type& val, string_type str) { - Json::Reader reader; - return reader.parse(str, val); + Json::CharReaderBuilder builder; + const std::unique_ptr reader(builder.newCharReader()); + + return reader->parse(reinterpret_cast(str.c_str()), + reinterpret_cast(str.c_str() + str.size()), &val, nullptr); } static string_type serialize(const value_type& val) {