Class JsonDiagnosticSanitizer
Turns a captured body into evidence that is safe to keep and readable in the viewer.
public static class JsonDiagnosticSanitizer
- Inheritance
-
JsonDiagnosticSanitizer
- Inherited Members
Methods
LooksLikeJson(string?)
Whether the content starts with a JSON object or array, ignoring leading whitespace.
public static bool LooksLikeJson(string? content)
Parameters
contentstring
Returns
Sanitize(string, JsonDiagnosticOptions?, bool)
Redacts sensitive properties in a captured body and truncates it to the configured length. A body that is not JSON is scanned as form, multipart or XML content instead.
public static string Sanitize(string content, JsonDiagnosticOptions? configured = null, bool truncate = true)
Parameters
contentstringconfiguredJsonDiagnosticOptionstruncatebool
Returns
Serialize(object?, JsonDiagnosticOptions?)
Renders a value as JSON and sanitizes it. A value that cannot be serialized as a whole degrades element by element, so one unserializable item does not cost the rest.
public static string Serialize(object? value, JsonDiagnosticOptions? configured = null)
Parameters
valueobjectconfiguredJsonDiagnosticOptions