Skip to main content

Module jsonc

Module jsonc 

Source
Expand description

JSONC parsing utilities for Ralph.

Responsibilities:

  • Provide JSONC (JSON with Comments) parsing with comment support.
  • Maintain backward compatibility with standard JSON.
  • Integrate with existing JSON repair logic for malformed files.

Not handled here:

  • File I/O (callers read/write file contents).
  • Round-tripping comments (comments are stripped on rewrite).

Invariants/assumptions:

  • Input is valid UTF-8.
  • jsonc-parser is used for parsing; serde_json for serialization.

Functionsยง

parse_jsonc
Parse JSONC (JSON with Comments) into a typed struct. Falls back to standard JSON parsing for backward compatibility.
to_string_pretty
Serialize to pretty-printed JSON (no comments preserved). Output is always standard JSON format.