diff --git a/src/json.hpp b/src/json.hpp index 62411195e..e1699aec6 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -17123,6 +17123,18 @@ inline nlohmann::json operator "" _json(const char* s, std::size_t n) return nlohmann::json::parse(s, s + n); } +/*! +@brief user-defined to_string function for JSON values + +This function implements a user-defined to_string for JSON objects. + +@param[in] j a JSON object +@return a std::string object +*/ +inline std::string to_string(const nlohmann::json& j) { + return j.dump(); +} + /*! @brief user-defined string literal for JSON pointer