Gathering detailed insights and metrics for parse-json
Gathering detailed insights and metrics for parse-json
Gathering detailed insights and metrics for parse-json
Gathering detailed insights and metrics for parse-json
@types/parse-json
Stub TypeScript definitions entry for parse-json, which provides its own types definitions
json-parse-better-errors
JSON.parse with context information on error
json-parse-even-better-errors
JSON.parse with context information on error
load-json-file
Read and parse a JSON file
npm install parse-json
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99
Supply Chain
99.5
Quality
77.7
Maintenance
100
Vulnerability
99.6
License
JavaScript (83.74%)
TypeScript (16.26%)
Total Downloads
14,694,161,685
Last Day
4,275,362
Last Week
72,108,841
Last Month
312,828,991
Last Year
3,136,859,454
MIT License
366 Stars
66 Commits
36 Forks
10 Watchers
1 Branches
15 Contributors
Updated on Jun 25, 2025
Minified
Minified + Gzipped
Latest Version
8.3.0
Package Id
parse-json@8.3.0
Unpacked Size
10.72 kB
Size
3.38 kB
File Count
5
NPM Version
10.9.2
Node Version
23.6.1
Published on
Apr 09, 2025
Cumulative downloads
Total Downloads
Last Day
-11.2%
4,275,362
Compared to previous day
Last Week
-8.2%
72,108,841
Compared to previous week
Last Month
4.6%
312,828,991
Compared to previous month
Last Year
9.8%
3,136,859,454
Compared to previous year
3
Parse JSON with more helpful errors
1npm install parse-json
1import parseJson, {JSONError} from 'parse-json'; 2 3const json = '{\n\t"foo": true,\n}'; 4 5 6JSON.parse(json); 7/* 8SyntaxError: Expected double-quoted property name in JSON at position 16 (line 3 column 1) 9*/ 10 11 12parseJson(json); 13/* 14JSONError: Expected double-quoted property name in JSON at position 16 (line 3 column 1) 15 16 1 | { 17 2 | "foo": true, 18> 3 | } 19 | ^ 20*/ 21 22 23parseJson(json, 'foo.json'); 24/* 25JSONError: Expected double-quoted property name in JSON at position 16 (line 3 column 1) in foo.json 26 27 1 | { 28 2 | "foo": true, 29> 3 | } 30 | ^ 31 fileName: 'foo.json', 32 [cause]: SyntaxError: Expected double-quoted property name in JSON at position 16 (line 3 column 1) 33 at JSON.parse (<anonymous>) 34 at ... 35*/ 36 37 38// You can also add the filename at a later point 39try { 40 parseJson(json); 41} catch (error) { 42 if (error instanceof JSONError) { 43 error.fileName = 'foo.json'; 44 } 45 46 throw error; 47} 48/* 49JSONError: Expected double-quoted property name in JSON at position 16 (line 3 column 1) in foo.json 50 51 1 | { 52 2 | "foo": true, 53> 3 | } 54 | ^ 55 56 fileName: 'foo.json', 57 [cause]: SyntaxError: Expected double-quoted property name in JSON at position 16 (line 3 column 1) 58 at JSON.parse (<anonymous>) 59 at ... 60*/
Throws a JSONError
when there is a parsing error.
Type: string
Type: Function
Prescribes how the value originally produced by parsing is transformed, before being returned. See JSON.parse
docs for more.
Type: string
The filename displayed in the error message.
Exposed for instanceof
checking.
Type: string
The filename displayed in the error message.
Type: string
The printable section of the JSON which produces the error.
Type: string
The raw version of codeFrame
without colors.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
security policy file detected
Details
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 15/30 approved changesets -- score normalized to 5
Reason
2 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 1
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-23
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 More