Lewati ke konten
TakoAPI
Kembali ke skill

json-repair-kit

oleh wanng-ide

PDF & Documents
502Unduhan dilaporkan oleh clawskills.sh
1Tayangan
0 sukaMasuk untuk menyukai skill ini
—Belum ada penilaian
Penilaian Anda

Ringkasan

Repair malformed JSON files by normalizing them through Node.js evaluation.

Deskripsi

Apa yang Dilakukan Skill Ini

Repairs malformed JSON files by parsing them as JavaScript objects and re-serializing as strict JSON. Handles trailing commas, single quotes, unquoted keys, JS-style comments, and hex/octal numbers. Operates on single files or entire directories recursively.

Uses vm.runInNewContext instead of direct eval, making it safer than regex-based fixers while handling a broader set of syntax errors in one pass.

Kapan Menggunakannya

  • Fixing config files with trailing commas added by hand-editing
  • Converting JS object literals copied into .json files
  • Batch-repairing all JSON files in a project directory
  • Normalizing JSON exported from tools using loose syntax
  • Recovering manually edited data files with mixed quote styles

Contoh Alur Kerja

INPUT

User asks: Repair my broken config.json that has trailing commas and unquoted keys

AGENT
  1. 1

    Identifies the broken JSON file at the specified path

  2. 2

    Creates a .bak backup of the original file

  3. 3

    Parses the file content using vm.runInNewContext as a JavaScript object

  4. 4

    Re-serializes the result as valid JSON

  5. 5

    Validates the output before writing it back to disk

OUTPUT

config.json is overwritten with valid JSON; config.json.bak preserves the original

Instalasi

clawhub install wanng-ide/json-repair-kit

Jalankan perintah CLI-nya, atau tempel prompt ke Claude Code, Cursor, Codex, atau coding agent apa pun yang Anda pakai.

Tautan