#totto2727/x/yaml

Wraps upstream YAML 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

Convert structured JSON-compatible configuration through the YAML wrapper while preserving nested values.

///|
test "convert a structured JSON value to YAML and back" {
let configuration : Yaml = @json.from_json(
@json.parse(
(
#|{
#| "name": "example",
#| "enabled": true,
#| "items": ["a", null]
#|}
),
),
)
@json.json_inspect(configuration.to_json(), content={
"name": "example",
"enabled": true,
"items": ["a", null],
})
}

#Package behavior

  • Converts nested YAML maps and arrays to JSON.
  • Preserves integer representations when decoding JSON numbers where possible.
  • Rejects non-finite numbers because JSON cannot represent them.

#API

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

Yaml

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

Yaml::Yaml

Wraps an upstream YAML value for standard JSON conversion.

Yaml::to_json

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

Source Files

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io