返回顶部
j

json-repair-kitJSON修复工具

Repair malformed JSON files by normalizing them through Node.js evaluation. Use this to fix trailing commas, single quotes, unquoted keys, or other common syntax errors in JSON files (e.g. config files, manually edited data).

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
817
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

json-repair-kit

JSON 修复工具

一个用于修复损坏或松散JSON文件(如包含尾随逗号、单引号或未加引号的键)的工具,通过将其解析为JavaScript对象并重新序列化为有效的JSON格式。

使用方法

bash

原地修复文件(创建.bak备份)


node skills/json-repair-kit/index.js --file path/to/broken.json

修复并保存到新文件

node skills/json-repair-kit/index.js --file broken.json --out fixed.json

扫描目录并修复所有.json文件(递归)

node skills/json-repair-kit/index.js --dir config/ --recursive

支持的修复类型

  • - 尾随逗号:{a: 1,} -> {a: 1}
  • 单引号:{a: b} -> {a: b}
  • 未加引号的键:{key: value} -> {key: value}
  • 注释:移除JS风格的注释//(如果解析器支持,标准Node的eval可能会去除字符串外部的行注释)
  • 十六进制/八进制数字:0xFF -> 255

安全性

  • - 备份:覆盖前始终创建.bak备份文件(除非使用--no-backup参数,但默认是安全的)
  • 验证:在写入前验证修复后的内容是否为有效的JSON
  • Eval沙箱:使用vm.runInNewContext进行解析,确保无法访问全局作用域或进程。比eval()更安全。

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 json-repair-kit-1776420061 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 json-repair-kit-1776420061 技能

通过命令行安装

skillhub install json-repair-kit-1776420061

下载

⬇ 下载 json-repair-kit v1.0.0(免费)

文件大小: 3.97 KB | 发布时间: 2026-4-17 20:10

v1.0.0 最新 2026-4-17 20:10
Initial release of JSON Repair Kit—a utility to fix malformed JSON files.

- Repairs common JSON syntax errors: trailing commas, single quotes, unquoted keys, JavaScript-style comments, and non-decimal numbers.
- Offers file and directory processing with backup creation by default.
- Ensures repaired content is valid JSON before saving.
- Uses a safe sandboxed environment for parsing to minimize risks.

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部