Skip to content

Commit b36e8a9

Browse files
Jsoncpp traits no longer uses deprecated Reader (#357)
* Jsoncpp traits no longer uses depricated Reader * linter changes --------- Co-authored-by: Christopher McArthur <[email protected]>
1 parent 3376880 commit b36e8a9

File tree

1 file changed

+5
-2
lines changed
  • include/jwt-cpp/traits/open-source-parsers-jsoncpp

1 file changed

+5
-2
lines changed

include/jwt-cpp/traits/open-source-parsers-jsoncpp/traits.h

+5-2
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,11 @@ namespace jwt {
117117
}
118118

119119
static bool parse(value_type& val, string_type str) {
120-
Json::Reader reader;
121-
return reader.parse(str, val);
120+
Json::CharReaderBuilder builder;
121+
const std::unique_ptr<Json::CharReader> reader(builder.newCharReader());
122+
123+
return reader->parse(reinterpret_cast<const char*>(str.c_str()),
124+
reinterpret_cast<const char*>(str.c_str() + str.size()), &val, nullptr);
122125
}
123126

124127
static string_type serialize(const value_type& val) {

0 commit comments

Comments
 (0)