Skip to main content

Module jsonc

Module jsonc 

Source
Expand description

JSON with comments and trailing commas — the dialect VS Code and TypeScript use for their config files — as HOCON config.

Plain JSON needs no adapter: HOCON is a JSON superset, so hocon::parse already accepts a .json file. This exists for the two things HOCON does not accept, block comments and trailing commas.

Comments are token-separating (spec F3.2): a comment is replaced by whitespace, never deleted, so it can never splice its neighbors into one token. {"a": 1/*x*/2} is a syntax error rather than the number 12.

Functions§

parse
Read JSONC text.
parse_file
Read a JSONC file, using its path as the origin description.