Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/spoonx/ezon
Easy-syntax JSON parser.
https://github.com/spoonx/ezon
Last synced: about 1 month ago
JSON representation
Easy-syntax JSON parser.
- Host: GitHub
- URL: https://github.com/spoonx/ezon
- Owner: SpoonX
- License: mit
- Created: 2017-04-06T07:03:12.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-04-06T07:14:38.000Z (over 7 years ago)
- Last Synced: 2024-11-14T06:32:09.275Z (about 1 month ago)
- Language: JavaScript
- Size: 1.95 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# EZON
> E-z (easy) Object Notation.
## Installation
`npm i --save ezon`
## Usage
Some working examples.### Basic
These all produce the same output `{ hello: 'world', bacon: 'truth' }`.
```js
const ezon = require('ezon');// Actual json
ezon('{"hello": "world", "bacon": "truth"}');// No curly braces
ezon('"hello": "world", "bacon": "truth"');// Messing around with the quotes
ezon(`hello: 'world', 'bacon': truth`);// Whatever this is..
ezon(`{hello:world, bacon: 'truth'}`);// Bare minimum
ezon('hello:world,bacon:truth');
```### Key default
When key and value are the same, you may only supply the key.
```js
const ezon = require('ezon');// Produces { foo: 'foo', cake: 'cake', hello: 'world', bacon: 'bacon' }
ezon('foo,cake,hello:world,bacon');
```### Configured key default
```js
const ezon = require('ezon');// Produces { message: 'bacon', hello: 'world' }
ezon('foo,cake,hello:world,bacon', {defaultKey: 'message'});// Well, what did you expect? You can only use the same key once.
```## Known limitations
At the moment, ezon doesn't support nested objects due to lacking support for recursion in javascript regex.
## License
MIT