Skip to content

Commit

Permalink
Jsoncpp traits no longer uses deprecated Reader (#357)
Browse files Browse the repository at this point in the history
* Jsoncpp traits no longer uses depricated Reader

* linter changes

---------

Co-authored-by: Christopher McArthur <[email protected]>
  • Loading branch information
kiddigital and prince-chrismc authored Jul 29, 2024
1 parent 3376880 commit b36e8a9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions include/jwt-cpp/traits/open-source-parsers-jsoncpp/traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<Json::CharReader> reader(builder.newCharReader());

return reader->parse(reinterpret_cast<const char*>(str.c_str()),
reinterpret_cast<const char*>(str.c_str() + str.size()), &val, nullptr);
}

static string_type serialize(const value_type& val) {
Expand Down

0 comments on commit b36e8a9

Please sign in to comment.