Jsonautorepair
A tiny library to auto repair JSON output from LLM
Install / Use
/learn @coderphonui/JsonautorepairREADME
LLM JSON auto repair
A tiny library to repair JSON string output from LLM. It fixes most of the common issues from the LLM JSON output, eg:
- Remove the
jsoncode block - Add missing commas
- Add missing double quotes when possible
- Replace single quotes with double quotes
- Escape special characters \t \n
- and many other common issues
Usage
Add dependency
<dependency>
<groupId>com.cdpn</groupId>
<artifactId>llm-json-auto-repair</artifactId>
<version>1.0.1</version>
</dependency>
Your Java code
import com.cdpn.jsonautorepair.JSONAutoRepairer;
JSONAutoRepairer jsonAutoRepairer = new JSONAutoRepairer();
String originalJSON = """
```json
{
"name": "Alice",
"sex": "female"
"address": "123 Andrew Street,
ward 3, district 10"
}
```
""";
String fixedJSON = jsonAutoRepairer.repair(originalJSON);
It will automatically fix the JSON string and return the fixed JSON string if possible. In case the JSON string cannot be fixed, it returns null
Related Skills
node-connect
337.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.2kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
337.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.2kCommit, push, and open a PR
