https://github.com/luckyscript/json_formater
format irregular json
https://github.com/luckyscript/json_formater
Last synced: 10 months ago
JSON representation
format irregular json
- Host: GitHub
- URL: https://github.com/luckyscript/json_formater
- Owner: luckyscript
- License: mit
- Created: 2020-01-17T10:08:22.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-05T04:38:26.000Z (about 3 years ago)
- Last Synced: 2025-02-02T08:18:07.304Z (11 months ago)
- Language: TypeScript
- Homepage:
- Size: 1.12 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Changelog: Changelog.md
- License: LICENSE
Awesome Lists containing this project
README
# 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

### Arraylike JSON

In addition, JSON has 6 value types,include above 2 types and 4 types following.
* number
* string
* boolean
* null

### string

### number

### 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.

## generator
transform AST to JSON code