Documentation
¶
Overview ¶
Package jsonc converts JSONC (JSON with comments and trailing commas, the dialect VS Code uses for devcontainer.json) into plain JSON that encoding/json accepts.
Strip replaces every comment byte and every trailing comma with a space rather than deleting it, so byte offsets are preserved: a json.SyntaxError reported against the stripped output still points at the right position in the original source.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Strip ¶
Strip returns src with // line comments, /* block */ comments, and trailing commas (a comma before a closing } or ]) replaced by spaces. Comments and commas inside string literals are left untouched. The returned slice has the same length as src.
It returns an error only for an unterminated string or block comment; malformed JSON that is otherwise lexically closed is left for the JSON parser to report.
Types ¶
This section is empty.