Crates.io | json-mumu |
lib.rs | json-mumu |
version | 0.1.2 |
created_at | 2025-08-15 13:10:12.297531+00 |
updated_at | 2025-08-16 13:21:41.406386+00 |
description | JSON tools and JSON Schema plugin for the Mumu ecosystem |
homepage | https://lava.nu11.uk |
repository | https://gitlab.com/tofo/mumu-json |
max_upload_size | |
id | 1796735 |
size | 97,574 |
JSON support for the Lava scripting language — a Rust plugin for data-driven scripting and automation.
Author: Tom Fotheringham & contributors
mumu-json
is a plugin that adds JSON parsing, encoding, validation, and JSON Schema support to Lava: a lightweight, embeddable scripting language and runtime written in Rust.
With mumu-json
, your Lava scripts get seamless, native JSON handling—essential for automation, configuration, and data transformation.
Who is this for?
Requires Lava. See lava.nu11.uk.
In this directory:
make
sudo make install
Installs libmumujson.so
to /usr/local/lib/
.
Enable the plugin in your Lava script:
extend("json")
extend("json")
person = [ name: "Alice", age: 30 ]
json_string = json:encode(person)
slog(json_string)
# Output: '{"name":"Alice","age":30}'
decoded = json:decode('{"name":"Bob","age":25}')
slog(decoded)
# Output: [ name: "Bob", age: 25 ]
pretty = json:encode([ pretty: true ], person)
slog(pretty)
# Output:
# {
# "name": "Alice",
# "age": 30
# }
is_valid = json:validate('{"ok":42}')
slog(is_valid) # true
is_valid = json:validate("{ bad: json }")
slog(is_valid) # false
result = json:report("{ bad: json }")
slog(result)
# Output: [ 'expected `:` at line 1 column 7' ]
schema = [
type: "object",
properties: [ name: [ type: "string" ], age: [ type: "integer" ] ]
]
person = [ name: "Alice", age: 30 ]
result = json:schema(schema, person)
slog(result)
# Output: [ ok: true, errors: [] ]
json:encode([options], value)
— encode Lava value to JSON (optionally pretty)json:decode(json_str)
— decode JSON string to Lava valuejson:validate(json_str)
— check JSON validity (returns true/false)json:report(json_str)
— array of error messages (if any)json:schema(schema, value)
— validate value against JSON Schema; returns [ ok: bool, errors: [ ... ] ]
_
as placeholder.Contributions and bug reports are welcome!
Submit issues or pull requests at https://gitlab.com/tofo/mumu-json.
Dual-licensed under MIT and Apache-2.0.