All Projects β†’ vtrushin β†’ Json To Ast

vtrushin / Json To Ast

Licence: mit
JSON AST parser

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Json To Ast

Metric Parser
πŸ“œ AST-based advanced mathematical parser written by Typescript.
Stars: ✭ 26 (-83.85%)
Mutual labels:  ast, tree, parser
Bad json parsers
Exposing problems in json parsers of several programming languages.
Stars: ✭ 351 (+118.01%)
Mutual labels:  json, parser, json-parser
Go
A high-performance 100% compatible drop-in replacement of "encoding/json"
Stars: ✭ 10,248 (+6265.22%)
Mutual labels:  json, parser, json-parser
Jsonparser
One of the fastest alternative JSON parser for Go that does not require schema
Stars: ✭ 4,323 (+2585.09%)
Mutual labels:  json, parser, json-parser
Xml Js
Converter utility between XML text and Javascript object / JSON text.
Stars: ✭ 874 (+442.86%)
Mutual labels:  json, parser, json-parser
Parson
Lightweight JSON library written in C.
Stars: ✭ 965 (+499.38%)
Mutual labels:  json, parser, json-parser
Java
jsoniter (json-iterator) is fast and flexible JSON parser available in Java and Go
Stars: ✭ 1,308 (+712.42%)
Mutual labels:  json, parser, json-parser
Object Visualizer
Vue JSON inspector with Chrome-like theme.
Stars: ✭ 159 (-1.24%)
Mutual labels:  tree, json
Django Jsoneditor
Django JSONEditor input widget to provide javascript online JSON Editor
Stars: ✭ 124 (-22.98%)
Mutual labels:  tree, json
Tiny Json
The tiny-json is a versatile and easy to use json parser in C suitable for embedded systems. It is fast, robust and portable.
Stars: ✭ 127 (-21.12%)
Mutual labels:  json, parser
Jaxon
Streaming JSON parser for Elixir
Stars: ✭ 145 (-9.94%)
Mutual labels:  json, parser
Alembic
βš—οΈ Functional JSON Parser - Linux Ready 🐧
Stars: ✭ 115 (-28.57%)
Mutual labels:  json, parser
Dynamodb Json
DynamoDB json util to load and dump strings of Dynamodb json format to python object and vise-versa
Stars: ✭ 114 (-29.19%)
Mutual labels:  json, json-parser
Phplrt
PHP Language Recognition Tool
Stars: ✭ 127 (-21.12%)
Mutual labels:  ast, parser
Json Git
A pure JS local Git to versionize any JSON
Stars: ✭ 109 (-32.3%)
Mutual labels:  tree, json
Json Autotype
Automatic Haskell type inference from JSON input
Stars: ✭ 139 (-13.66%)
Mutual labels:  json, parser
Prettier
Prettier is an opinionated code formatter.
Stars: ✭ 41,411 (+25621.12%)
Mutual labels:  ast, json
Babylon
PSA: moved into babel/babel as @babel/parser -->
Stars: ✭ 1,692 (+950.93%)
Mutual labels:  ast, parser
Spotify Json
Fast and nice to use C++ JSON library.
Stars: ✭ 145 (-9.94%)
Mutual labels:  json, json-parser
Gelatin
Transform text files to XML, JSON, or YAML
Stars: ✭ 150 (-6.83%)
Mutual labels:  json, parser

JSON AST parser

NPM NPM downloads Requirements Travis-CI

Install

> npm install json-to-ast

Usage

const parse = require('json-to-ast');

const settings = {
  // Appends location information. Default is <true>
  loc: true,
  // Appends source information to node’s location. Default is <null>
  source: 'data.json'
};

parse('{"a": 1}', settings);

Output

{
  type: 'Object',
  children: [
    {
      type: 'Property',
      key: {
        type: 'Identifier',
        value: 'a',
        raw: '"a"',
        loc: {
          start: { line: 1, column: 2, offset: 1 },
          end: { line: 1, column: 5, offset: 4 },
          source: 'data.json'
        }
      },
      value: {
        type: 'Literal',
        value: 1,
        raw: '1',
        loc: {
          start: { line: 1, column: 7, offset: 6 },
          end: { line: 1, column: 8, offset: 7 },
          source: 'data.json'
        }
      },
      loc: {
        start: { line: 1, column: 2, offset: 1 },
        end: { line: 1, column: 8, offset: 7 },
        source: 'data.json'
      }
    }
  ],
  loc: {
    start: { line: 1, column: 1, offset: 0 },
    end: { line: 1, column: 9, offset: 8 },
    source: 'data.json'
  }
}

Node types

Object:

{
  type: 'Object',
  children: <Property>[],
  loc?: Object
}

Property:

{
  type: 'Property',
  key: <Identifier>,
  value: Object | Array | <Literal>,
  loc?: Object
}

Identifier:

{
  type: 'Identifier',
  value: string,
  raw: string,
  loc?: Object
}

Array:

{
  type: 'Array',
  children: (Object | Array | <Literal>)[],
  loc?: Object
}

Literal:

{
  type: 'Literal',
  value: string | number | boolean | null,
  raw: string,
  loc?: Object
}

AST explorer

Try it online on astexplorer.net

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].