JSONLint
A real JSON linter and toolkit for the terminal. Validate syntax, pretty-print, minify, compare files, list keys, and extract values by path — all powered by python3.
Commands
| Command | Description |
|---|
| INLINECODE1 | Check JSON syntax — reports type, element count, file size, and shows error context on failure |
| INLINECODE2 |
Pretty-print JSON with 4-space indentation |
|
jsonlint minify <file> | Compact JSON (remove all whitespace), shows bytes saved |
|
jsonlint diff <file1> <file2> | Deep structural comparison of two JSON files — shows added, removed, and changed values with dot-paths |
|
jsonlint keys <file> | List all top-level keys with types and value previews |
|
jsonlint extract <file> <path> | Extract a value by dot-path (e.g.
config.database.host), supports array indices like
items[0] |
Requirements
- -
python3 (uses json stdlib module)
Examples
CODEBLOCK0
技能名称: JSONLint
详细描述:
JSONLint
一个基于终端的真实JSON校验工具和工具包。支持语法验证、美化输出、压缩、文件对比、列出键值以及按路径提取值——全部由python3驱动。
命令
| 命令 | 描述 |
|---|
| jsonlint validate <文件> | 检查JSON语法——报告类型、元素数量、文件大小,并在失败时显示错误上下文 |
| jsonlint format <文件> |
使用4空格缩进美化JSON输出 |
| jsonlint minify <文件> | 压缩JSON(移除所有空白),显示节省的字节数 |
| jsonlint diff <文件1> <文件2> | 两个JSON文件的深度结构对比——以点路径形式显示新增、删除和变更的值 |
| jsonlint keys <文件> | 列出所有顶级键及其类型和值预览 |
| jsonlint extract <文件> <路径> | 通过点路径提取值(例如 config.database.host),支持数组索引如 items[0] |
系统要求
示例
bash
验证配置文件
jsonlint validate config.json
美化输出API响应
jsonlint format response.json
为部署压缩文件
jsonlint minify package.json
比较两个版本
jsonlint diff old.json new.json
列出JSON文件中的内容
jsonlint keys data.json
深入嵌套值
jsonlint extract config.json database.host