Partial JSON parser extracted from OpenAI's vendored version.
MIT License
Partial JSON parser extracted from OpenAI's vendored version.
This package exports OpenAI's vendored version of partial-json-parser as a standalone module, which itself is a refactored version of the original npm partial-json-parser.
It also adds some much-needed unit tests.
This package will be kept in sync with any changes to OpenAI's vendored version.
[!NOTE] This package requires
Node.js >= 18
or an equivalent environment (Bun, Deno, CF workers, etc).
npm install openai-partial-json-parser
import { partialParse } from 'openai-partial-json-parser'
const json = partialParse('{ "foo": true, ')
// { foo: true }
partial-json-parser
without depending on the entire openai
package.partial-json-parser
doesn't have any unit tests for some reason, which could cause undesired regressions.partial-json-parser
for openai-fetch, dexter, and agentic.zod-to-json-schema
with support OpenAI's strict
mode for structured outputs.MIT © Travis Fischer