You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A JSON parser and validator with a command-line client. A [pure JavaScript version](http://prantlf.github.com/jsonlint/) of the service provided at [jsonlint.com](http://jsonlint.com).
10
+
A [JSON]/[JSON5] parser and validator with a command-line client. A [pure JavaScript version] of the service provided at [jsonlint.com].
11
11
12
12
This is a fork of the original package with the following enhancements:
13
13
14
14
* Handles multiple files on the command line (by Greg Inman).
15
15
* Walks directories recursively (by Paul Vollmer).
16
16
* Provides 100% compatible interface to the native `JSON.parse` method.
17
17
* Optionally recognizes JavaScript-style comments and single quoted strings.
18
-
* Supports JSON Schema drafts 04, 06 and 07.
19
-
* Prefers the native JSON parser to gain the [best performance](./benchmarks#json-parser-comparison), while showing error messages of the same quality.
20
-
* Implements JavaScript modules using [UMD](https://github.com/umdjs/umd) to work everywhere.
18
+
* Supports [JSON Schema] drafts 04, 06 and 07.
19
+
* Prefers the native JSON parser to gain the [best performance], while showing error messages of the same quality.
20
+
* Implements JavaScript modules using [UMD] to work everywhere.
21
21
* Depends on up-to-date npm modules with no installation warnings.
22
22
* Small size - 17.6 kB minified, 6.1 kB gzipped.
23
23
@@ -76,16 +76,18 @@ By default, `jsonlint` will either report a syntax error with details or pretty-
76
76
-i, --in-place overwrite the input files
77
77
-t, --indent [char] characters to use for indentation (default: " ")
78
78
-c, --compact compact error display
79
+
-M, --mode set other parsing flags according to a format type
79
80
-C, --comments recognize and ignore JavaScript-style comments
80
81
-S, --single-quoted-strings support single quotes as string delimiters
81
82
-V, --validate [file] JSON schema file to use for validation
82
-
-e, --environment [env] which specification of JSON Schema the validation
83
-
file uses
83
+
-e, --environment [env] which specification of JSON Schema
84
+
the validation file uses
84
85
-q, --quiet do not print the parsed json to stdin
85
86
-p, --pretty-print force pretty-printing even for invalid input
86
87
-v, --version output the version number
87
88
-h, --help output usage information
88
89
90
+
Parsing mode can be "cjson" or "json5" to enable other flags automatically.
89
91
If no files or directories are specified, stdin will be parsed. Environments
90
92
for JSON schema validation are "json-schema-draft-04", "json-schema-draft-06"
91
93
or "json-schema-draft-07". If not specified, it will be auto-detected.
@@ -125,8 +127,17 @@ The `parse` method offers more detailed [error information](#error-handling), th
This is a part of an output from the [parser benchmark](./benchmarks#json-parser-comparison), when parsing a 4.2 KB formatted string ([package.json](./package.json)) with Node.js 10.15.3:
164
+
This is a part of an output from the [parser benchmark], when parsing a 4.2 KB formatted string ([package.json](./package.json)) with Node.js 10.15.3:
154
165
155
166
the built-in parser x 61,588 ops/sec ±0.75% (80 runs sampled)
156
167
the pure jju parser x 11,396 ops/sec ±1.05% (86 runs sampled)
157
168
the extended jju parser x 8,221 ops/sec ±0.99% (87 runs sampled)
158
169
159
-
A custom JSON parser is [a lot slower](./benchmarks/results/performance.md#results) than the built-in one. However, it is more important to have a [clear error reporting](./benchmarks/results/errorReportingQuality.md#results) than the highest speed in scenarios like parsing configuration files. Extending the parser with the support for comments and single-quoted strings does not affect significantly the performance.
170
+
A custom JSON parser is [a lot slower] than the built-in one. However, it is more important to have a [clear error reporting] than the highest speed in scenarios like parsing configuration files. Extending the parser with the support for comments and single-quoted strings does not affect significantly the performance.
160
171
161
172
### Error Handling
162
173
@@ -201,3 +212,14 @@ ${reason}`)
201
212
Copyright (C) 2012-2019 Zachary Carter, Ferdinand Prantl
0 commit comments