SkillAgentSearch skills...

Jsonautorepair

A tiny library to auto repair JSON output from LLM

Install / Use

/learn @coderphonui/Jsonautorepair
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

LLM JSON auto repair

Build

Coverage

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 json code 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

View on GitHub
GitHub Stars13
CategoryDevelopment
Updated2mo ago
Forks3

Languages

Java

Security Score

90/100

Audited on Jan 16, 2026

No findings