Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/pup/deps.ts>jsonc.parse

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

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

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" }

Parameters

text: string

A valid JSONC string.

optional
unnamed 1: ParseOptions = [UNSUPPORTED]