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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
use *;
/// Formats JSON (`.json`, `tsconfig.json`, `.vscode/*.json`) matching VS Code Prettier 3.7.4 `json` parser (`tabWidth: 2`, `printWidth: 80`, `objectWrap: "preserve"`, allows comments, strips trailing commas).
///
/// # Arguments
///
/// - `&str` - Raw JSON source text.
///
/// # Returns
///
/// - `Result<String, io::Error>` - Formatted JSON text, or an invalid-data I/O error on syntax failure.
/// Formats JSON manifests (`package.json`, `package-lock.json`, `composer.json`) matching VS Code Prettier 3.7.4 `json-stringify` parser.
///
/// # Arguments
///
/// - `&str` - Raw JSON manifest text.
///
/// # Returns
///
/// - `Result<String, io::Error>` - Expanded JSON text, or an invalid-data I/O error on syntax failure.
/// Formats JSONC (`.jsonc`, `.cjson`) matching VS Code Prettier 3.7.4 `jsonc` parser (preserving comments and `trailingComma: "all"`).
///
/// # Arguments
///
/// - `&str` - Raw JSONC source text.
///
/// # Returns
///
/// - `String` - Formatted JSONC text, or unchanged input if syntax errors occur.
/// Formats JSON source using the requested `tidy::json::Dialect` and VS Code Prettier 3.7.4 options.
///
/// # Arguments
///
/// - `&str` - Raw JSON text.
/// - `tidy::json::Dialect` - Target Prettier JSON dialect (`Json`, `Stringify`, or `Jsonc`).
///
/// # Returns
///
/// - `Result<String, io::Error>` - Formatted JSON string or invalid-data I/O error.