Installations
npm install fast-json
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
18.13.0
NPM Version
8.19.3
Score
73.3
Supply Chain
93.6
Quality
75.7
Maintenance
100
Vulnerability
100
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
TypeScript (67.22%)
JavaScript (32.78%)
Developer
alemures
Download Statistics
Total Downloads
53,346
Last Day
139
Last Week
434
Last Month
2,071
Last Year
18,664
GitHub Statistics
129 Stars
108 Commits
10 Forks
2 Watching
5 Branches
2 Contributors
Bundle Size
6.34 kB
Minified
1.99 kB
Minified + Gzipped
Package Meta Information
Latest Version
3.0.0
Package Id
fast-json@3.0.0
Unpacked Size
20.58 kB
Size
5.46 kB
File Count
16
NPM Version
8.19.3
Node Version
18.13.0
Publised On
05 Mar 2023
Total Downloads
Cumulative downloads
Total Downloads
53,346
Last day
101.4%
139
Compared to previous day
Last week
3.8%
434
Compared to previous week
Last month
19%
2,071
Compared to previous month
Last year
6.7%
18,664
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
fast-json
A lightning fast on the fly JSON parser able to return JSON values and structures from plain JSON as String
or Buffer
. It's much faster than JSON.parse() and doesn't require any extra memory allocation for the data processed.
Install
npm install fast-json
Usage
1const { FastJson } = require('fast-json'); 2 3const data = JSON.stringify({ 4 ireland: { 5 people: [{ name: 'Alex' }, { name: 'John' }, { name: 'Cian' }], 6 }, 7 spain: { 8 people: [{ name: 'Antonio' }, { name: 'Juan' }, { name: 'Pedro' }], 9 }, 10}); 11 12const fastJson = new FastJson(); 13 14// Path is a string representing a javascript object path 15fastJson.on('ireland.people', (value) => { 16 console.log('ireland.people ->', value); 17}); 18 19// Paths can be also an array of keys 20fastJson.on(['spain', 'people', '1', 'name'], (value) => { 21 console.log(['spain', 'people', '1', 'name'], '->', value); 22}); 23 24// Wildcards can be used to match all items in object or array 25fastJson.on('spain.people[*].name', (value) => { 26 console.log('spain.people[*].name ->', value); 27}); 28 29fastJson.on('*.people[*].name', (value) => { 30 console.log('*.people[*].name ->', value); 31}); 32 33fastJson.write(data); 34// The JSON can be string or Buffer 35// fastJson.write(Buffer.from(data))
1fastJson.on('ireland.people[1].name', (value) => { 2 console.log('ireland.people[1].name ->', value); 3 // Once we have all we need, we can skip the rest of the JSON to improve performance. 4 fastJson.skip(); 5});
1// Path separator defines the keys separator on the listeners 2const fastJson = new FastJson({ pathSeparator: '/' }); 3 4// In this case it allows keys having dots by using a different separator 5fastJson.on('unknown.country/people/0/name', (value) => { 6 console.log('unknown.country/people/0/name ->', value); 7});
Performance
JSON file citylots.json of 189MB from https://github.com/zemirco/sf-city-lots-json.
- fast-json: 0.56s / 198MB RAM
- JSON.parse: 1.8s / 640MB RAM
- jsonparse: 15.0s / 1,100MB RAM (Only reading, it wasn't able to return a value)
TODO
- [Feature] Allow chunked JSON.
- [Feature] Match more glob patters.
- [Feature] Add more flexibility to event listeners (on, once, off, etc).
- [Documentation] Create branch gh-pages using jsdoc.
- [Documentation] More real life testing and examples.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
8 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9
- Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm
- Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92
- Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7
Reason
Found 1/27 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 6 are checked with a SAST tool
Score
1.6
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn MoreOther packages similar to fast-json
fast-json-stable-stringify
deterministic `JSON.stringify()` - a faster version of substack's json-stable-strigify without jsonify
fast-json-patch
Fast implementation of JSON-Patch (RFC-6902) with duplex (observe changes) capabilities
read-package-json-fast
Like read-package-json, but faster
fast-json-stringify
Stringify your JSON at max speed