Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions jsonc/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
* {@link https://code.visualstudio.com/docs/languages/json#_json-with-comments | JSONC}
* (JSON with comments).
*
* On top of what JSON allows, this module accepts line comments (`//`), block
* comments, and a trailing comma after the last member of an object or array.
* Comments are discarded when parsing.
*
* Currently, this module only provides a means of parsing JSONC. JSONC
* serialization is not yet supported.
*
Expand Down
5 changes: 5 additions & 0 deletions jsonc/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ export type { JsonValue };
/**
* Converts a JSON with Comments (JSONC) string into an object.
*
* On top of what JSON allows, line comments (`//`), block comments, and a
* trailing comma after the last member of an object or array are accepted.
* Comments are discarded.
*
* @example Usage
* ```ts
* import { parse } from "@std/jsonc";
Expand All @@ -18,6 +22,7 @@ export type { JsonValue };
* ```
*
* @throws {SyntaxError} If the JSONC string is invalid.
* @throws {TypeError} If called with `new`.
* @param text A valid JSONC string.
* @returns The parsed JsonValue from the JSONC string.
*/
Expand Down
Loading