11#include <userver/formats/json/value.hpp>
12#include <userver/utils/fast_pimpl.hpp>
13#include <userver/utils/fmt_compat.hpp>
15USERVER_NAMESPACE_BEGIN
23namespace formats::
json {
25constexpr inline std::size_t kDepthParseLimit = 128;
54 PrettyFormat format = {});
58 const formats::
json::Value&);
69class StringBuffer final {
71 explicit StringBuffer(
const formats::json::Value& value);
74 std::string_view GetStringView()
const;
78 static constexpr std::size_t kSize = 48;
79 static constexpr std::size_t kAlignment = 8;
80 utils::FastPimpl<Impl, kSize, kAlignment> pimpl_;
90struct fmt::formatter<USERVER_NAMESPACE::formats::json::Value>
91 : fmt::formatter<std::string_view> {
92 constexpr static auto parse(format_parse_context& ctx)
93 ->
decltype(ctx.begin()) {
97 template <
typename FormatContext>
98 auto format(
const USERVER_NAMESPACE::formats::json::Value& value,
100 const USERVER_NAMESPACE::formats::json::impl::StringBuffer buffer(value);
101 return formatter<string_view>::format(buffer.GetStringView(), ctx);