Skip to main content
Module

x/jsonc/main.ts

Scanner and parser for JSON with comments.
Latest
import * as jsonc from "https://deno.land/x/jsonc@1/main.ts";

Variables

Creates a JSON scanner on the given text. If ignoreTrivia is set, whitespaces or comments are ignored.

Finds the node at the given path in a JSON DOM.

Finds the innermost node at the given offset. If includeRightBound is set, also finds nodes that end at the given offset.

For a given offset, evaluate the location in the JSON document. Each segment in the location path is either a property name or an array index.

Gets the JSON path of the given JSON DOM node

Evaluates the JavaScript object of the given JSON DOM node

Parses the given text and returns the object the JSON content represents. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result. Therefore, always check the errors list to find out if the input was valid.

Parses the given text and returns a tree representation the JSON content. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result.

Takes JSON with JavaScript-style comments and remove them. Optionally replaces every none-newline character of comments with a replaceCharacter

Parses the given text and invokes the visitor functions for each object, array and literal reached.

Functions

Applies edits to a input string.

Computes the edits needed to format a JSON document.

Computes the edits needed to modify a value in the JSON document.

Interfaces

Represents a text modification

The scanner object, representing a JSON scanner at a position in the input string.

Options used when computing the modification edits

A text range in the document