Skip to content

Commit

Permalink
Backport uncaught nlohmann json exception
Browse files Browse the repository at this point in the history
  • Loading branch information
ashishb-solo committed Jul 2, 2024
1 parent c46fc3c commit 69cb25e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion source/common/json/json_internal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,9 @@ std::vector<ObjectSharedPtr> Field::asObjectArray() const {

std::string Field::asJsonString() const {
nlohmann::json j = asJsonDocument();
return j.dump();
// Call with defaults except in the case of UTF-8 errors which we replace
// invalid UTF-8 characters instead of throwing an exception.
return j.dump(-1, ' ', false, nlohmann::detail::error_handler_t::replace);
}

bool Field::empty() const {
Expand Down

0 comments on commit 69cb25e

Please sign in to comment.