Skip to content

A parser that allows editing while _maintaining the structure_ of json.

License

Notifications You must be signed in to change notification settings

GunseiKPaseri/perfect-json-parser

Repository files navigation

perfect-json-parser

JSR GitHub

A parser that allows editing while maintaining the structure of json.

  • support
  • support order retenation ( minimal change )
  • support comment (jsonc)

[!WARNING] unsupport json5

Usage

import { parse } from "jsr:@gunseikpaseri/perfect-json-parser";

const jsonFile = `
{
  "hoge": "fuga"
}
`;

const parsed = parse(jsonFile);

parsed.edit(["hoge"], "piyo");

const editedJson = parsed.stringify();

console.log(editedJson);
//{
//  "hoge": "piyo"
//}

Internals

chevrotain is used for parsing. Syntax diagram can be seen from json_sytax_diagram.html

About

A parser that allows editing while _maintaining the structure_ of json.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors