json-repair : A library for fixing JSON anomalies generated by LLMs.

Logo

CN doc

What is json-repair?

json-repair is a Java library that provides repair for abnormal JSON generated by LLM (Large Language Model) at the application layer. Based on json-repair, the repair of abnormal JSON can be achieved simply, efficiently and accurately.

Getting started

To get started with json-repair, first add it as a dependency in your Java project. If you're using Maven, that looks like this:

If you're using Gradle, that looks like this:

Next, You can instantiate a JSONRepair object then call handle() function to repair JSON string like so.

Feature

You can learn about all the JSON exceptions that the current version 0.2.2 of json-repair supports for repair by checking the test case dataset or test report.

The functions based on the current version 0.2.2 are as follows:

Benchmark

You can conduct performance tests in more scenarios by running BenchmarkTests.

The benchmark based on the current version 0.2.2 as follows:

Coverage

You can check out report to learn about the details of the project's test coverage.

Roadmap

License

json-repair is licensed under the Apache-2.0 license.