# Repair malformed JSON before parsing downstream automations with jsonrepair

> Use jsonrepair when an agent receives JSON-like output that is almost valid but still breaks parsers, such as trailing commas, missing quotes, or concatenated fragments. The agent’s role is to normalize the payload before validation or routing, not to replace real schema design.

- Skill: `agentskillexchange/repair-malformed-json-before-parsing-downstream-automations-` (Agent Skill)
- Install (CLI): `npx skillmds@latest add agentskillexchange/repair-malformed-json-before-parsing-downstream-automations-`
- Raw SKILL.md: https://api.skillmd.com/api/skills/agentskillexchange/repair-malformed-json-before-parsing-downstream-automations-/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- Author: agentskillexchange (https://skillmd.com/u/agentskillexchange)
- Updated: 2026-09-08
- Page: https://skillmd.com/skills/agentskillexchange/repair-malformed-json-before-parsing-downstream-automations-

---


# Repair malformed JSON before parsing downstream automations with jsonrepair

Use jsonrepair when an agent receives JSON-like output that is almost valid but still breaks parsers, such as trailing commas, missing quotes, or concatenated fragments. The agent’s role is to normalize the payload before validation or routing, not to replace real schema design.

## Prerequisites

Node.js or CLI, JSON-like input data

## Installation

Use the upstream install or setup path that matches your environment:
- $ npm install jsonrepair
- $ npm install -g jsonrepair
- npm install | Install the dependencies once
- npm run build | Build the library (ESM, CommonJs, and UMD output in the folder lib)

Requirements and caveats from upstream:
- Replace Python constants None, True, and False with null, true, and false
- Use the streaming API in Node.js:
- import { createReadStream, createWriteStream } from 'node:fs'

Basic usage or getting-started notes:
- Turn newline delimited JSON into a valid JSON array, for example:
- Note that in the lib folder, there are builds for ESM, UMD, and CommonJs.
- ## Use

- Source: https://github.com/josdejong/jsonrepair
- Extracted from upstream docs: https://raw.githubusercontent.com/josdejong/jsonrepair/HEAD/README.md

## Documentation

- https://github.com/josdejong/jsonrepair

## Source

- [Agent Skill Exchange](https://agentskillexchange.com/skills/repair-malformed-json-before-parsing-downstream-automations-jsonrepair/)

