From b37960b975a292a312f393212f6fbf8f02689284 Mon Sep 17 00:00:00 2001 From: Marius Elvert Date: Tue, 22 Nov 2022 21:19:02 +0100 Subject: [PATCH] Use one dump overload from the other --- include/nlohmann/json.hpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index 413ba2ac6..81a443991 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -1267,21 +1267,15 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec const bool ensure_ascii = false, const error_handler_t error_handler = error_handler_t::strict) const { - string_t result; - serializer s(detail::output_adapter(result), indent_char, error_handler); - - if (indent >= 0) - { - s.dump(*this, true, ensure_ascii, static_cast(indent)); - } - else - { - s.dump(*this, false, ensure_ascii, 0); - } - - return result; + return dump(indent, indent_char, ensure_ascii, error_handler, [](basic_json const&, int) {return true;}); } + /// @name object inspection + /// Functions to inspect the type of a JSON value. + /// @{ + + /// @brief serialization + /// @sa https://json.nlohmann.me/api/basic_json/dump/ template string_t dump(const int indent, const char indent_char,