Docs
What it is
json_mlake is a packaged build of json by Ehsan M. Kermani: simdjson-backed JSON parsing for Mojo, with value types, reflection, JSONPath, schema validation and a GPU backend. magmalake republishes it only because json isn’t on a conda channel pixi can resolve, and flare_mlake and k8s need it. The code is upstream’s and the module is still imported as json. Star it and file issues upstream.
Install
mojoshelf:
pixi shelf add json_mlake # no other tins; brings simdjson from conda-forgepixi shelf comes with mojoshelf: install it first.
plain pixi:
pixi init app -c https://conda.modular.com/max -c conda-forge && cd app
sed -i.bak 's/^\[workspace\]/[workspace]\npreview = ["pixi-build"]/' pixi.toml
pixi add "mojo-compiler==1.2.0"
# Without mojoshelf: the tin as a git dependency at its published commit.
# Transitive dependencies may be wrong: pixi takes the tin's own git deps as
# pinned in its pixi.toml, which may not match what other tins pin, and then
# fails with "duplicate records". mojoshelf picks revisions that agree.
pixi add json_mlake --git https://github.com/magmalake/json_mlake --rev bcaa7161e757748a1310a213e123bf8810ff7e96No mojoshelf needed. If pixi reports duplicate records, the mojoshelf tab picks revisions that agree.
Then from json import ... as upstream documents. The package build compiles the simdjson wrapper into the environment’s lib/, so you need no compiler of your own. The GPU parser (json.gpu) is opt-in: add max-core ==26.7 to your own dependencies, since that package is under the Modular Community License.
What magmalake changed
It tracks upstream v0.4.2. The one source delta:
- The simdjson wrapper is found without
CONDA_PREFIX(json/cpu/_dlopen.mojo): it looks in$CONDA_PREFIX/lib, then the executable’s directory and its../lib, then the binary’s rpath, so a binary built under pixi runs from a plain shell. A missing wrapper raises an Error that says to setCONDA_PREFIX. Upstream’s fallback tobuild/libsimdjson_wrapper.sorelative to the working directory is dropped.
And packaging:
- The package is named
json_mlake; the module staysjson, so switching to an official package later is a one-line dependency change. mojodocis dropped from the dev feature, so thedocstask isn’t available.- CI builds the package and consumes it from a clean project on linux-64 and osx-arm64, instead of running upstream’s test matrix; upstream’s docs and fuzz workflows are dropped.
The repository is archived the day json is on a channel pixi can resolve.
Upstream
- Project, issues and pull requests: github.com/ehsanmok/json
- Documentation: ehsanmok.github.io/json
- Upstream’s README, verbatim: README.upstream.md
The full reference is the README on GitHub.