← 返回命令列表

Linux command

jsonlint 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Validate JSON file

jsonlint [file.json]

Validate with quiet mode

jsonlint -q [file.json]

Validate and format

jsonlint -i [file.json]

Compact output

jsonlint -c [file.json]

Sort keys

jsonlint -s [file.json]

Validate multiple files

jsonlint [file1.json] [file2.json]

说明

jsonlint validates and formats JSON files. It checks for syntax errors and can pretty-print or compact JSON data. The tool is useful for validating configuration files, API responses, and data files. It provides clear error messages for malformed JSON.

参数

-q, --quiet
No output, just exit code.
-c, --compact
Compact output.
-i, --in-place
Format and overwrite file.
-s, --sort-keys
Sort object keys.
-t _chars_
Tab characters for indent.
-e _env_
Use environment for input.
-p, --pretty-print
Pretty print output.
-V, --validate
Validate only, no output.

FAQ

What is the jsonlint command used for?

jsonlint validates and formats JSON files. It checks for syntax errors and can pretty-print or compact JSON data. The tool is useful for validating configuration files, API responses, and data files. It provides clear error messages for malformed JSON.

How do I run a basic jsonlint example?

Run `jsonlint [file.json]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -q, --quiet do in jsonlint?

No output, just exit code.