json-repair-kit_skill

This skill repairs malformed JSON files by safely parsing and re-serializing them to valid JSON, fixing trailing commas, quotes, unquoted keys, and comments.
  • Python

2.5k

GitHub Stars

4

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill openclaw/skills --skill json-repair-kit

  • _meta.json285 B
  • index.js3.5 KB
  • package.json288 B
  • SKILL.md1.5 KB

Overview

This skill repairs malformed or "loose" JSON files by parsing them as JavaScript objects and re-serializing them as valid JSON. It targets common syntactic issues like trailing commas, single quotes, unquoted keys, comments, and nonstandard numeric literals. The tool runs under Node.js, creates safe backups by default, and validates output before writing.

How this skill works

The script loads the target file or directory and attempts to evaluate the contents inside a Node.js VM sandbox to interpret JavaScript-style object literals. It normalizes the parsed object by re-serializing with JSON.stringify, which enforces strict JSON syntax. Before overwriting any file it creates a .bak backup (unless disabled) and verifies the final text is valid JSON.

When to use it

  • You have configuration or data files edited by hand that fail JSON.parse due to syntax leniencies.
  • A tool produced JSON-like output with trailing commas, comments, or single quotes.
  • You need to bulk-fix many .json files in a project or config directory.
  • You want a quick repair without manually editing large or nested files.
  • You need a safe repair workflow with automatic backups and validation.

Best practices

  • Run on a copy or rely on the default .bak backup before altering originals.
  • Review diffs between the original and repaired file, especially for numeric conversions (hex/octal).
  • Use recursive directory mode for bulk fixes but confirm file selection first.
  • Avoid running on untrusted files from unknown sources; the VM sandbox reduces risk but best practice is to inspect input.
  • Include the repaired files in version control so you can track and revert changes.

Example use cases

  • Fix a single broken config.json created by manual edits that included trailing commas and comments.
  • Batch-repair a repository of JSON fixtures with unquoted keys and single-quoted strings.
  • Normalize exported data files that contain hex numbers into standard decimal JSON numbers.
  • Prepare a set of config files for a linter or parser that requires strict JSON compliance.
  • Automate repairs in a CI step to convert loosely formatted JSON into valid artifacts.

FAQ

It is safer than raw eval because it uses a VM sandbox and creates .bak backups, but run on copies or ensure backups are available before changing production files.

Will it change data values when repairing?

Repairs preserve the logical values, but numeric literals like 0xFF are converted to their decimal equivalents and comments are removed, which can alter text content if comments were significant.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational