jsonast
Version:
a json to ast parser which allows error recovery
13 lines (12 loc) • 499 B
TypeScript
import * as Types from './types';
export * from './types';
/**
* Parses a given string into a Json AST.
* This parser does some error correction (notably missing comma in objects and arrays).
* The template parameter could be used to qualify the result AST.
*
* @export
* @param {string} text The Json text to parse
* @returns {JsonObject|JsonArray} Either a Json Object or Json Array AST node
*/
export default function parse<T extends Types.JsonObject | Types.JsonArray>(text: string): T;