| description | Modern alternatives to toml for TOML parsing and stringifying |
|---|
toml appears to be unmaintained and has known spec-compliance issues.
smol-toml is a well maintained TOML v1.1.0 parser/stringifier with full spec compliance, comment/AST support, and no deps.
Parse (load):
import toml from 'toml' // [!code --]
import { parse } from 'smol-toml' // [!code ++]
const obj = toml.parse(src) // [!code --]
const obj = parse(src) // [!code ++]Stringify:
import { stringify } from 'smol-toml'
const text = stringify(obj)Native TOML parsing is supported in Bun.
Example:
import toml from 'toml' // [!code --]
import { TOML } from 'bun' // [!code ++]
toml.parse(src) // [!code --]
TOML.parse(src) // [!code ++]