jsonette
A lightweight, zero-dependency, UI-agnostic JSON parse, format, query, and diagnostics engine written in Rust. It serves as the shared core for the jsonette native editors and viewers.
Features
- Tolerant & Incremental Parsing: Built to handle malformed or partially written JSON documents in real-time editor views.
- Tree Model Inference: Builds a lightweight virtual tree representing the JSON hierarchy, ideal for lazy/virtualized outline views.
- Standardized Querying: Fully supports RFC 9535 JSONPath queries using
serde_json_path. - Intelligent Autocomplete: Infers available keys, types, and completions at specific cursor offsets or JSONPath strings.
- Diagnostics Translation: Maps precise byte-offsets to line/column dimensions for UI error highlighting.
- FFI-Ready: Engineered with a clean, flat public API compatible with UniFFI for binding to native shells (e.g., Swift/SwiftUI, Tauri, Kotlin).
Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Quick Start Usage
1. Parsing & Querying JSON
use ;
2. Formatting & Pretty Printing
use Formatter;
Architecture and FFI Bindings
The jsonette engine is deliberately decoupled from any UI framework. The engine maintains 100% of the parse, query, and configuration state, exposing a thread-safe API. For macOS/iOS, it compiles into a static/dynamic library and binds via UniFFI to generate Swift wrappers.
For more details on the desktop project structure, see the Root README.
License
Dual-licensed under either:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.