JSPM

zerteiler

0.1.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • 0
  • Score
    100M100P100Q5520F
  • License MIT

🧱 A simple JSON parser for handling incomplete JSON strings from LLM tool calls.

Package Exports

  • zerteiler

Readme

🧱 Zerteiler: A simple JSON parser for handling incomplete JSON strings from LLM tool calls

⚠️ The library is yet only experimental and might change over time.

📖 Usage

import { parse } from 'zerteiler';
import { z } from "zod";

const schema = z.object({
  path: z.string(),
  content: z.string(),
});

const invalidJsonString = `{\"path\": \"// This is a comment \nconst content = {"test": "value"} `;

const validJSON = parse(invalidJsonString, schema)
console.log(validJSON)

Output:

{ "path": `// This is a comment \nconst content = {"test": "value"} `, "content": null}

📚 Installation

npm install zerteiler

📝 License

This project is licensed under the terms of the MIT license. See the LICENSE file for details.