1.1.0 • Published 4 years ago

@luckylab/json-formater v1.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

json formater

We always have a headache when we want to make an Object to a json string;

Think this case: when we want to copy our javascript object{'a': 1} to some mock platform, it always shows JSON error, because it's not a correct json.

so we use JSON.stringify and then copy? However, it always produce some escape and other token.

Use this package to solve the problem!just:

import formater from 'json-formater';
formater.format('{a: "b"}')

parser

JSON has 2 types

  • object
  • array

Objectlike JSON

npm.io

Arraylike JSON

npm.io

In addition, JSON has 6 value types,include above 2 types and 4 types following.

  • number
  • string
  • boolean
  • null

npm.io

string

npm.io

number

npm.io

boolean & null

boolean & null has literal value: true, false, null

whitespace

Whitespace can be inserted between any pair of tokens. Excepting a few encoding details, that completely describes the language. npm.io

generator

transform AST to JSON code

1.1.0

4 years ago

0.0.1

4 years ago