#json #lua #api-bindings

mlua-json

A Rust-native implementation of LuaRocks openresty/lua-cjson or grafi/lunajson for mlua

4 releases (2 stable)

1.0.1 Aug 1, 2025
1.0.0 Oct 29, 2024
0.1.1 Oct 19, 2024
0.1.0 Aug 11, 2024

#154 in #lua

Download history 202/week @ 2026-01-01 39/week @ 2026-01-08 50/week @ 2026-01-15 8/week @ 2026-01-22 122/week @ 2026-01-29 102/week @ 2026-02-05 9/week @ 2026-02-12 68/week @ 2026-02-19 119/week @ 2026-02-26 62/week @ 2026-03-05 27/week @ 2026-03-12 42/week @ 2026-03-26 13/week @ 2026-04-02 90/week @ 2026-04-16

145 downloads per month
Used in mlua-arete-sdk

MIT license

230KB
229 lines

mlua-json

Rust-native JSON support for mlua.

License Arch Lua

Installing

Add to your Rust project using one of MLua's features: [lua51, lua52, lua53, lua54, luajit, luajit52].

$ cargo add mlua-json --features luajit

Using

use mlua::Lua;

let lua = Lua::new();
mlua_json::preload(&lua);
let script = r#"
    local json = require('json')
    local table = json.decode('{"abc":123,"def":true}')
    local s = json.encode(table)
"#;

Testing

$ make check

Dependencies

~2.1–3.5MB
~65K SLoC