npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@bread2333/llmx

v1.1.0

Published

Utilities for working with LLM outputs (e.g. fuzzy JSON extraction/parsing).

Readme

llmx

Utilities for working with LLM outputs.

Currently this crate focuses on turning "fuzzy" JSON-like text (common in LLM responses) into real serde_json::Value.

Features

  • Fuzzy JSON parsing: Handle markdown code fences, single-quoted strings, unquoted keys, Python literals (True/False/None), trailing commas
  • Partial JSON parsing: Auto-complete incomplete JSON structures (useful for streaming)
  • Streaming parser: Accumulate chunks and parse at any point

Rust Usage

use llmx::json::parse_fuzzy_json;

let v = parse_fuzzy_json("```json\n{'a': True, b: None}\n```").unwrap();
assert_eq!(v["a"], true);
assert!(v["b"].is_null());

Streaming JSON Parsing

use llmx::json::StreamingJsonParser;

let mut parser = StreamingJsonParser::new();

// Simulate streaming input
parser.push(r#"{"name":"#);
let v = parser.parse_partial().unwrap();
assert!(v.is_object());

parser.push(r#""Alice","age":30}"#);
let v = parser.parse_partial().unwrap();
assert_eq!(v["name"], "Alice");
assert_eq!(v["age"], 30);

TypeScript/JavaScript Usage (WebAssembly)

Install via npm:

npm install llmx

API

parseFuzzyJson(input: string): any

Parse fuzzy JSON-like text into a JavaScript value. Handles:

  • Markdown code fences (```json ... ```)
  • Single-quoted strings
  • Unquoted object keys
  • Python literals (True/False/None)
  • Trailing commas
import { parseFuzzyJson } from "llmx";

const value = parseFuzzyJson("```json\n{'a': True, b: None}\n```");
console.log(value); // { a: true, b: null }

parsePartialJson(input: string): any

Parse partial/incomplete JSON, automatically completing unclosed structures. Useful for streaming LLM outputs.

import { parsePartialJson } from "llmx";

const value = parsePartialJson('{"name": "Alice", "age":');
console.log(value); // { name: "Alice", age: null }

parsePartialJsonWithStatus(input: string): { value: any; isComplete: boolean }

Parse partial JSON and return both the value and completion status.

import { parsePartialJsonWithStatus } from "llmx";

const result = parsePartialJsonWithStatus('{"name": "Alice"}');
console.log(result.value);      // { name: "Alice" }
console.log(result.isComplete); // true

const partial = parsePartialJsonWithStatus('{"name": "Ali');
console.log(partial.value);      // { name: "Ali" }
console.log(partial.isComplete); // false

StreamingJsonParser class

Streaming JSON parser for incremental LLM output parsing.

import { StreamingJsonParser } from "llmx";

const parser = new StreamingJsonParser();

// Simulate streaming input
parser.push('{"name":');
console.log(parser.parsePartial()); // { name: null }

parser.push('"Alice","age":30}');
console.log(parser.parsePartial()); // { name: "Alice", age: 30 }

// Check completion status
const { value, isComplete } = parser.parsePartialWithStatus();
console.log(isComplete); // true

// Access buffer contents
console.log(parser.buffer()); // '{"name":"Alice","age":30}'

// Clear for reuse
parser.clear();
Methods

| Method | Description | |--------|-------------| | new StreamingJsonParser() | Create a new parser instance | | push(chunk: string) | Append a chunk of data to the buffer | | buffer(): string | Get the current buffer contents | | clear() | Clear the parser buffer | | parsePartial(): any | Parse buffer with auto-completion | | parsePartialWithStatus(): { value: any; isComplete: boolean } | Parse with completion status | | parseComplete(): any | Parse as complete JSON (no auto-completion, throws if incomplete) |