Performance-Focused JS
Optimized JS engine with benchmarks to track real-world performance
Benchmark-tracked JSONPath with TypeScript-first DX
import { JSONPath } from '@jsonpathx/jsonpathx';
const data = {
store: {
book: [
{ title: 'Sayings of the Century', price: 8.95 },
{ title: 'Moby Dick', price: 8.99 },
{ title: 'The Lord of the Rings', price: 22.99 }
]
}
};
// Simple query
const titles = await JSONPath.query('$.store.book[*].title', data);
// ['Sayings of the Century', 'Moby Dick', 'The Lord of the Rings']
// Filter by condition
const cheapBooks = await JSONPath.query('$.store.book[?(@.price < 10)]', data);
// [{ title: 'Sayings of the Century', price: 8.95 }, { title: 'Moby Dick', price: 8.99 }]
// Fluent API
const result = await JSONPath.create(data)
.query('$.store.book[*]')
.filter(book => book.price < 10)
.map(book => book.title)
.execute();
// ['Sayings of the Century', 'Moby Dick']npm install @jsonpathx/jsonpathxjsonpathx tracks performance against jsonpath-plus and jsonpath across real workloads. In the current benchmark suite, jsonpathx wins the majority of queries (44/48). Results still vary by query; see the benchmarks page for current numbers.
Built from the ground up with TypeScript, providing full type safety, excellent IDE support, and a delightful developer experience.
With a growing test suite covering edge cases, error handling, and performance scenarios, jsonpathx is production-ready.
| Feature | jsonpathx | jsonpath-plus | jsonpath |
|---|---|---|---|
| Performance | Varies by query (see benchmarks) | Varies by query | Varies by query |
| TypeScript | Built-in typings | .d.ts only | No |
| Engine | JS | JS | JS |
| Fluent API | Yes | No | No |
| Type Selectors | Yes | No | No |
| Parent Navigation | Yes | Yes | No |
| Result Types | 7 types | 4 types | 1 type |
| Caching | Built-in (opt-in) | No | No |
| Tests | 40+ (current suite) | Unknown | Unknown |
| Bundle Size | Measured via npm run size | See upstream | See upstream |