repair-json-stream
repair-json-stream is a fast, zero-dependency JavaScript library for repairing malformed or incomplete JSON, designed for streaming responses from large language models like OpenAI and Anthropic. It fixes truncated strings, missing brackets, unquoted keys, single quotes, Python-style constants, trailing commas, comments, markdown code fences, JSONP wrappers, MongoDB types, string concatenation, and NDJSON. Benchmarks show it is roughly 1.9x faster than alternatives, with a small bundle size of about 5.5KB. It can be used as a function call in Node.js or the browser, as a stream transform for pipeline processing of large files, or as a command-line tool for repairing JSON files from disk or stdin. Main use cases include real-time JSON parsing during LLM streaming output, cleaning up partial or broken API responses, processing large JSON datasets in a streaming fashion, and converting NDJSON streams into arrays.