Skip to content

Latest commit

 

History

History
14 lines (12 loc) · 991 Bytes

README.md

File metadata and controls

14 lines (12 loc) · 991 Bytes

json5-parser

Scanner and parser for JSON5 based on Microsoft's node-jsonc-parser.

WARNING: This package is experimental and not recommended for general use until v1.0.0.

Why?

This node module provides a scanner and fault tolerant parser that can process JSON5.

  • the scanner tokenizes the input string into tokens and token offsets
  • the visit function implements a 'SAX' style parser with callbacks for the encountered properties and values.
  • the parseTree function computes a hierarchical DOM with offsets representing the encountered properties and values.
  • the parse function evaluates the JavaScript object represented by JSON5 string in a fault tolerant fashion.
  • the getLocation API returns a location object that describes the property or value located at a given offset in a JSON5 document.
  • the findNodeAtLocation API finds the node at a given location path in a JSON5 DOM.