Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/xadillax/fbibik-json
Parse JSON-Object string (not normalized JSON string) into JSON object.
https://github.com/xadillax/fbibik-json
Last synced: 5 days ago
JSON representation
Parse JSON-Object string (not normalized JSON string) into JSON object.
- Host: GitHub
- URL: https://github.com/xadillax/fbibik-json
- Owner: XadillaX
- License: mit
- Created: 2014-10-20T09:23:55.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2022-03-15T23:41:09.000Z (over 2 years ago)
- Last Synced: 2024-05-02T00:36:17.607Z (7 months ago)
- Language: JavaScript
- Size: 65.4 KB
- Stars: 34
- Watchers: 7
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# F[嗶][嗶]k JSON
[![fbbk-json](http://img.shields.io/npm/v/fbbk-json.svg)](https://www.npmjs.org/package/fbbk-json)
[![TravisCI](https://img.shields.io/travis/XadillaX/fbibik-json/master.svg)](https://travis-ci.org/XadillaX/fbibik-json)
[![Coveralls](https://img.shields.io/coveralls/XadillaX/fbibik-json/master.svg)](https://coveralls.io/r/XadillaX/fbibik-json)
[![Dependency Status](https://david-dm.org/XadillaX/fbibik-json.svg)](https://david-dm.org/XadillaX/fbibik-json)Parse JSON-Object string (not normalized JSON string) into JSON object.
## Installation
```sh
$ npm install fbbk-json --save
```or
```sh
$ bower install fbbk-json --save
```## Usage
This package has only one function:
```javascript
var fJSON = require("fbbk-json");
fJSON.parse(A_JSON_STRING);
```### BUT
This package support the JSON string that written down like a JSON object in javascript.
For example:
```
'{"foo": "bar","baz": true}' <-- both JSON and fJSON are supported
'{foo: "bar",baz: true}' <-- only fJSON supported! ٩(๑•̀ω•́๑)۶
```So you can do that:
```javascript
var json1 = '{,,"foo": "bar",,,"baz": true,,}';
var json2 = '{foo: \'bar\',baz: true,c:[]}';JSON.parse(json1); ///< SyntaxError: Unexpected token , in JSON at position 1
JSON.parse(json2); ///< SyntaxError: Unexpected token f
fJSON.parse(json1); ///< { foo: 'bar', baz: true }
fJSON.parse(json2); ///< { foo: 'bar', baz: true, c: [] } \(●´ϖ`●)/
```## Contribute
You're welcome to make pull requests!
「雖然我覺得不怎麼可能有人會關注我」