pub struct JsonDecodeOptions {
pub trim_whitespace: bool,
pub strip_utf8_bom: bool,
pub strip_markdown_code_fence: bool,
pub strip_markdown_code_fence_requires_closing: bool,
pub strip_markdown_code_fence_json_only: bool,
pub escape_control_chars_in_strings: bool,
pub max_input_bytes: Option<usize>,
}Expand description
Configuration switches for crate::LenientJsonDecoder.
Each flag controls one normalization rule applied before parsing JSON. Defaults are intentionally conservative and cover the most common non-fully-trusted text inputs without attempting aggressive repair.
Fields§
§trim_whitespace: boolControls whether leading and trailing whitespace is removed before any other normalization step is applied.
strip_utf8_bom: boolControls whether a leading UTF-8 byte order mark (U+FEFF) is removed
before parsing.
strip_markdown_code_fence: boolControls whether one outer Markdown code fence is removed.
Typical examples include json ... and bare fenced blocks
starting with ````` followed by a newline.
strip_markdown_code_fence_requires_closing: boolControls whether Markdown fence stripping requires a matching closing fence.
When enabled, an opening fence without a valid closing fence keeps the input unchanged.
strip_markdown_code_fence_json_only: boolControls whether Markdown fence stripping only accepts JSON-like
language tags (json, jsonc, or empty tag).
When enabled, fenced blocks labeled with other languages are not stripped.
escape_control_chars_in_strings: boolControls whether raw ASCII control characters inside JSON string literals are converted into valid JSON escape sequences.
max_input_bytes: Option<usize>Caps the accepted raw input size in bytes before normalization.
When set to Some(limit), any input whose byte length is greater than
limit is rejected before further processing. When set to None,
no size limit is enforced.
Trait Implementations§
Source§impl Clone for JsonDecodeOptions
impl Clone for JsonDecodeOptions
Source§fn clone(&self) -> JsonDecodeOptions
fn clone(&self) -> JsonDecodeOptions
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more