Skip to main content
Module

x/pup/deps.ts>jsonc

Universal process manager built in Deno
Go to Latest
namespace jsonc
import { jsonc } from "https://deno.land/x/pup@1.0.0-rc.14/deps.ts";

Provides tools for working with JSONC (JSON with comments). Currently, this module only provides a means of parsing JSONC. JSONC serialization is not yet supported.

This module is browser compatible.

Examples

Example 1

import { parse } from "https://deno.land/std@0.224.0/jsonc/mod.ts";

parse('{"foo": "bar", } // comment'); // { foo: "bar" }
parse('{"foo": "bar", } /* comment *\/'); // { foo: "bar" }
parse('{"foo": "bar" } // comment', {
  allowTrailingComma: false,
}); // { foo: "bar" }

Functions

Converts a JSON with Comments (JSONC) string into an object. If a syntax error is found, throw a SyntaxError.

Type Aliases

The type of the result of parsing JSON.