凡自治之物 · LGD 治理学 · 创造术家族 | 评测协议:见平台质量门禁规范
English
When to use
- When input JSON is messy, padded with stray whitespace or has unsorted keys, and needs standardizing for readability.
- When JSON content moves through a data pipeline with a restricted environment where external tools cannot be installed (zero-dependency runtime).
- When a JSON parse error occurs and you need the exact line and column of the error instead of a vague "invalid" message.
Usage
- Command: run
python json_tidy.py [options]to start the main script. - Input: read directly from stdin, or specify a file path as the data source.
- Parameters:
--formatpicks compact or pretty mode,--sort-keysenables key sorting,--loc-errorprints detailed line/column location.
Workflow
- Confirm the input file format; ensure the content is a valid JSON fragment or a full document.
- Invoke the appropriate python interpreter to load
json_tidy.pyand set the format options. - Pipe the data in, or point at the file path, and run the conversion.
- The system parses and formats the data, also flagging the line/column of any syntax error.
- Take the standardized JSON output and verify it meets the expected formatting or minification goal.
Evidence & safety statement
- Evidence: TBD (no evaluation / badge link yet; update here once it is produced)
- Version: 1.0.5
- Security: no independent security scan has been performed (TBD); the conclusion is pending and no endorsement is given until it is completed.
中文
何时用
- 当输入 JSON 数据格式混乱、包含多余空白或键名无序,需要标准化整理以提升可读性时。
- 在数据处理管道中处理 JSON 内容,且环境受限无法安装外部依赖工具以保证零依赖运行时时。
- 遇到 JSON 解析异常,需要通过精确的行号与列号定位错误位置而非笼统报错信息时。
用法
- 调用命令:执行
python json_tidy.py [选项]启动主脚本处理逻辑。 - 输入方式:支持从标准输入(stdin)直接读取或指定文件路径作为数据源。
- 参数配置:主要包含
--format指定压缩或美观模式、--sort-keys开启键名排序及--loc-error输出详细行列定位。
流程
- 确认待处理的数据文件格式,确保其内容为有效的 JSON 结构片段或完整文档。
- 根据实际需求在命令行中调用对应版本的 python 解释器加载
json_tidy.py并配置格式选项参数。 - 将数据输入标准管道或直接指定文件路径启动脚本执行命令转换。
- 系统自动解析并格式化数据,同时检查潜在的语法错误行号与列号。
- 获取处理后的标准化 JSON 输出并验证其是否符合预期规范或压缩目标。
证据与安全声明
- 证据:TBD(暂无评测/徽章链接;产生后在此更新实际链接)
- 版本:1.0.5
- 安全:未做独立安全扫描(TBD),结论待补;补全前不作推荐背书。
