1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//! JSON file metadata (line-based stats, root type, depth, formatting).
use serde::{Deserialize, Serialize};
/// JSON file metadata: byte count, line count, line ending, max line length, blank lines,
/// root type, root size, max depth, and whether the content is pretty-printed.
#[derive(Debug, Clone, Default, Deserialize, Serialize)]
pub struct JsonMetadata {
/// File size in bytes
pub byte_count: usize,
/// Number of lines
pub line_count: usize,
/// Dominant line ending: "lf", "crlf", or "cr"
#[serde(skip_serializing_if = "Option::is_none")]
pub line_ending: Option<String>,
/// Longest line length in bytes
#[serde(skip_serializing_if = "Option::is_none")]
pub max_line_length: Option<usize>,
/// Number of blank (empty or whitespace-only) lines
#[serde(skip_serializing_if = "Option::is_none")]
pub blank_line_count: Option<usize>,
/// Root value type: "array" or "object"
#[serde(skip_serializing_if = "Option::is_none")]
pub root_type: Option<String>,
/// If root is array, number of elements
#[serde(skip_serializing_if = "Option::is_none")]
pub root_array_length: Option<usize>,
/// If root is object, number of keys
#[serde(skip_serializing_if = "Option::is_none")]
pub root_object_key_count: Option<usize>,
/// Maximum nesting depth of the JSON structure
#[serde(skip_serializing_if = "Option::is_none")]
pub max_depth: Option<usize>,
/// True if content appears pretty-printed (contains newlines after structural chars)
#[serde(skip_serializing_if = "Option::is_none")]
pub pretty_printed: Option<bool>,
}