An exact, RFC-8259 JSON value parser and renderer for Lean 4, built on
grip. It is pure and byte-oriented: it performs no
IO and does not depend on a terminal or a JSON-specific runtime.
import GripJson
#eval Grip.Json.parseString "{\"answer\": 42}"
-- .ok (obj #[("answer", num 42 0)])Numbers are represented exactly as a mantissa and decimal exponent; parsing never rounds through
Float. Strings validate UTF-8 and decode JSON escapes, including surrogate pairs. The parser
returns positioned Grip.ParseError values on failure.
Lean programs need JSON parsing that preserves exact numbers, validates the full format, and reports where invalid input occurs.
This project is maintained by its author with AI-assisted development tools. Changes are reviewed, tested, and remain the maintainer's responsibility.
oatp uses grip-json for its JSON configuration.
Pin the newest release tag (the Release badge above shows it) in place of vX.Y.Z:
require «grip-json» from git
"https://github.com/jonaprieto/lean-grip-json.git" @ "vX.Y.Z"lake build GripJson GripJsonTest Examples tests demo readme conformance bench
bash tools/run-conformance.sh
lake exe benchThe checked-in JSONTestSuite corpus gates grammar behavior. The benchmark keeps separate rows for Grip's allocation-light validator, the Grip DOM parser, Lean's standard DOM parser, and the cross-language reference harnesses. Only the validator is the strict no-DOM cross-language task; the DOM rows are reported as local comparison context.
Apache-2.0.