返回顶部
j

json-repair-kit

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
安全检测
已通过
745
下载量
0
收藏
概述
安装方式
版本历史

json-repair-kit

# JSON Repair Kit A utility to repair broken or "loose" JSON files (like those with trailing commas, single quotes, or unquoted keys) by parsing them as JavaScript objects and re-serializing as valid JSON. ## Usage ```bash # Repair a file in place (creates .bak backup) node skills/json-repair-kit/index.js --file path/to/broken.json # Repair and save to a new file node skills/json-repair-kit/index.js --file broken.json --out fixed.json # Scan directory and repair all .json files (recursive) node skills/json-repair-kit/index.js --dir config/ --recursive ``` ## Supported Repairs - **Trailing Commas**: `{"a": 1,}` -> `{"a": 1}` - **Single Quotes**: `{'a': 'b'}` -> `{"a": "b"}` - **Unquoted Keys**: `{key: "value"}` -> `{"key": "value"}` - **Comments**: Removes JS-style comments `//` (if parser supports it, standard Node `eval` may strip them if they are line comments outside of strings). - **Hex/Octal Numbers**: `0xFF` -> `255` ## Safety - **Backup**: Always creates a `.bak` file before overwriting (unless `--no-backup` is used, but default is safe). - **Validation**: Verifies the repaired content is valid JSON before writing. - **Eval Sandbox**: Uses `vm.runInNewContext` to parse, ensuring no access to global scope or process. It is safer than `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

下载 Zip 包

⬇ 下载 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
返回顶部