userver: formats::json::MaskingRules Class Reference
Loading...
Searching...
No Matches
formats::json::MaskingRules Class Referencefinal

#include <userver/formats/json/masking.hpp>

Detailed Description

Immutable compiled masking rules, cheaply copyable and safe to share. A whole segment "*" matches any member name unless an exact child exists. Exact and wildcard branches are not merged or retried on a later mismatch. An empty path selects the root. Empty blacklists preserve everything; empty whitelists mask everything. Incomplete whitelist paths hide scalars.

Definition at line 32 of file masking.hpp.

Public Member Functions

 MaskingRules (const std::vector< MaskingPath > &paths={}, MaskingListMode mode=MaskingListMode::kBlacklist)
 Compile paths once for reuse by subsequent masking calls.

◆ MaskJson

MaskedJson MaskJson ( std::string_view input,
const MaskingRules & rules,
std::size_t log_limit )
friend

Mask JSON using RapidJSON streaming parsing and serialization. Scalars become "...", objects "{...}", and arrays "[...]". Output is compact JSON until log_limit bytes are produced; then parsing stops and the result may be incomplete JSON. No suffix is added. Reaching the budget, even exactly, sets formats::json::MaskedJson::limit_reached; the unread input suffix is not validated. A zero budget skips parsing. A single input token may be fully decoded before its SAX callback runs.

Exceptions
formats::json::ParseExceptionon invalid JSON, invalid UTF-8, or excessive nesting encountered before reaching the budget. Error messages contain no input fragments. Rules and input are never modified.

The documentation for this class was generated from the following file: