Starting points for your own code. Run them in the environment shown below.
Node.js 22+ · ES module (.mjs)
Current inputs apply only to fields used by the example. Selected files are not embedded.
Install dependencies
npm install yaml smol-toml
import YAML from "yaml";
import * as TOML from "smol-toml";
const value = { name: "demo", port: 8080, enabled: true };
const yaml = YAML.stringify(value);
const toml = TOML.stringify(value);
console.log(yaml, toml);
console.log(JSON.stringify(YAML.parse(yaml), null, 2));
console.log(JSON.stringify(TOML.parse(toml), null, 2));
// TOML does not support null.
Put it to work
Convert configuration files between formats.
Details that matter
Format and meaning
Comments and formatting are not preserved. TOML requires a root object and cannot represent null.
Supported scope and limits
Text 1 MB
Split inputs that exceed the limit. If a format or algorithm is unsupported, choose a tool that matches your requirements instead of silently changing the format.