#totto2727/x/toml

Wraps upstream TOML values so they can use MoonBit's standard JSON conversion traits without violating foreign-trait rules. See the module README for consumer setup and package imports.

#Usage

Parse a structured TOML configuration and expose its nested values through standard JSON conversion.

///|
test "convert a parsed TOML configuration to JSON" {
let configuration = TomlValue::TomlValue(
@upstream_toml.parse(
(
#|title = "example"
#|enabled = true
#|
#|[owner]
#|name = "Ada"
),
),
)
@json.json_inspect(configuration.to_json(), content={
"title": "example",
"enabled": true,
"owner": { "name": "Ada" },
})
}

#Package behavior

  • Converts nested TOML tables and arrays to JSON.
  • Decodes JSON strings as TomlString and does not infer date-time variants.
  • Rejects JSON null and non-finite numbers because TOML or JSON has no matching value.

#API

This README was generated from the share-artifact skill and README template.

TomlValue

Owns an upstream TOML value so standard JSON traits can be implemented without violating MoonBit's foreign-trait implementation rule.
impl ToJson for TomlValue

TomlValue::TomlValue

Wraps an upstream TOML value for standard JSON conversion.

TomlValue::to_json

fn TomlValue::to_json(self : TomlValue) -> Json

Source Files

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io