summaryrefslogtreecommitdiff
path: root/src/utils/cpp/json.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/cpp/json.hpp')
-rw-r--r--src/utils/cpp/json.hpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/utils/cpp/json.hpp b/src/utils/cpp/json.hpp
index aed2f3f4..9fd2d66d 100644
--- a/src/utils/cpp/json.hpp
+++ b/src/utils/cpp/json.hpp
@@ -21,6 +21,7 @@
#include <string>
#include <unordered_map>
+#include "fmt/ostream.h"
#include "gsl/gsl"
#include "nlohmann/json.hpp"
#include "src/utils/cpp/gsl.hpp"
@@ -212,4 +213,10 @@ namespace detail {
return old_abbrev;
}
+// Use nlohmann::basic_json::operator<<() for formatting via libfmt.
+// This explicit template specialization seems to be required starting with
+// libfmt 10.x.
+template <>
+struct fmt::formatter<nlohmann::basic_json<>> : ostream_formatter {};
+
#endif // INCLUDED_SRC_UTILS_CPP_JSON_HPP