kdleam
kdleam parses, serializes, normalizes, and builds KDL v2 documents in Gleam.
Install
gleam add kdleam
Usage
import kdleam
import kdleam/document
pub fn main() {
let assert Ok(doc) = kdleam.parse("node \"hello\" flag=#true\n")
let assert Some(node) = document.first_node(doc)
let assert Some("hello") = document.first_string_arg(node)
kdleam.serialize(doc)
}
Public modules
kdleam: Parsing, serialization, and normalization.kdleam/document: Document types and queries.kdleam/error: Parse errors.kdleam/builder: Document construction.kdleam/value: Conversion to and from an intermediate representation.kdleam/json: Conversion to plain JSON strings.
Targets
The same public API is available on the Erlang and JavaScript backends.
Limitations
The input format is KDL v2. Numbers retain their raw representation. An Int or Float is available only when that value can be represented.
License
MIT