Skip to main content

parse_jsonc

Function parse_jsonc 

Source
pub fn parse_jsonc(input: &str) -> Result<Value, Error>
Expand description

Strip // line comments, /* */ block comments and trailing commas from JSONC, then parse with serde_json. String contents are preserved verbatim.

This makes lean-ctx tolerant of the JSONC dialect that editors like VS Code use for settings.json / mcp.json (comments + trailing commas are valid there but rejected by strict JSON). See issue #311.