luadata
A Lua data parser that converts Lua data files (such as World of Warcraft SavedVariables) to JSON.
Install
cargo add luadata
Usage
use ;
// From a string
let json = text_to_json?;
// From a file
let json = file_to_json?;
// With options
let mut config = new;
config.array_mode = Some;
config.empty_table_mode = Array;
let json = text_to_json?;
Options
All parse functions accept a ParseConfig with three option groups:
- String transform — limit string length during parsing (
truncate,empty,redact,replace) - Array detection — control how integer-keyed Lua tables map to JSON arrays (
sparse,index-only,none) - Empty tables — choose how empty Lua tables render in JSON (
null,omit,array,object)
See the full options documentation for details and examples.
Links
- Luadata by Example — guided tour with interactive examples
- Live Converter — try it in your browser
- GitHub