json-repair-js

JavaScript library to repair broken/invalid JSON strings, especially from LLM outputs

jsesc

Given some data, jsesc returns the shortest possible stringified & ASCII-safe representation of that data.