Fast and compliant JSON parser and serializer for MoonBit supporting the full JSON specification with strict validation, unicode escapes, pretty printing, and detailed error reporting
moon add maria/json_parser// Parse JSON
let json_str = "{\"name\": \"MoonBit\", \"version\": 1}"
let value = parse(json_str)
// Extract values
match value {
Object(obj) => {
println(obj.get("name")) // Some("MoonBit")
}
_ => ()
}
// Create and stringify
let data : JsonValue = Object({
"name": String("Alice"),
"age": Number(30.0),
})
println(stringify(data))
// {"name":"Alice","age":30}type Lexerpub(all) struct Position {
line : Int
column : Int
}type TokenInstall
Download zipFast and compliant JSON parser and serializer for MoonBit supporting the full JSON specification with strict validation, unicode escapes, pretty printing, and detailed error reporting