JSON Autocomplete is designed to complete incomplete JSON strings. It's especially effective for handling partial outputs from Large Language Models (LLMs) like OpenAI's GPT.
Install using npm:
npm install json-autocompleteOr using Yarn:
yarn add json-autocompleteImport jsonAutocomplete and pass incomplete JSON strings to get them completed:
constjsonAutocomplete=require("json-autocomplete");// Completing LLM OutputconstincompleteLLMOutput='{"items":[{"name":"Appl';console.log(jsonAutocomplete(incompleteLLMOutput));// Outputs: {"items":[{"name":"Appl"}]}// Handling Incomplete KeysconstincompleteKeyJson='{"user":{"id":123,"nam';console.log(jsonAutocomplete(incompleteKeyJson));// Outputs: {"user":{"id":123}}- Optimized for completing JSON from LLMs like OpenAI's GPT.
- Handles a wide range of incomplete JSON formats.
- Lightweight (1KB) and dependency-free.
Your contributions are welcome! For bug fixes, improvements, or feature additions, feel free to open an issue or submit a pull request.
This project is licensed under the MIT License - see the LICENSE.md file for details.
Follow us on Twitter!
