

# [`oro:toml`](/runtime/docs/javascript/toml/)

[`oro:toml`](/runtime/docs/javascript/toml/) parses and serializes TOML documents.

## Examples

Parse configuration and emit updated TOML back to disk:

```js
import { parse, stringify } from 'oro:toml'

const config = parse('name = "oro"\nport = 8080')
config.debug = true

console.log(stringify(config))
```

## API reference

<!-- GENERATED: ORO_API_REFERENCE_START -->

### Module specifiers

```text
oro:toml
```

### TypeScript declarations

These declarations are generated from the runtime's published TypeScript surface.

#### [`oro:toml`](/runtime/docs/javascript/toml/)

```ts
declare module "oro:toml" {
    /**
     * Parse a TOML document and return a JavaScript representation.
     *
     * @param {string} source
     * @param {{ reviver?: (key: string, value: unknown) => unknown }} [options]
     * @returns {any}
     */
    export function parse(source: string, options?: {
        reviver?: (key: string, value: unknown) => unknown;
    }): any;
    /**
     * Serialize a JavaScript object into a TOML document.
     *
     * @param {Record<string, any>} table
     * @param {{}} [options]
     * @returns {string}
     */
    export function stringify(table: Record<string, any>, options?: {}): string;
    /**
     * Represents a TOML local date.
     */
    export class TomlLocalDate {
        /**
         * @param {number} year
         * @param {number} month
         * @param {number} day
         */
        constructor(year: number, month: number, day: number);
        year: number;
        month: number;
        day: number;
        toString(): string;
        toJSON(): string;
    }
    /**
     * Represents a TOML local time.
     */
    export class TomlLocalTime {
        /**
         * @param {number} hour
         * @param {number} minute
         * @param {number} second
         * @param {number} nanosecond
         */
        constructor(hour: number, minute: number, second: number, nanosecond: number);
        hour: number;
        minute: number;
        second: number;
        nanosecond: number;
        toString(): string;
        toJSON(): string;
    }
    /**
     * Represents a TOML local date-time.
     */
    export class TomlLocalDateTime {
        /**
         * @param {TomlLocalDate} date
         * @param {TomlLocalTime} time
         */
        constructor(date: TomlLocalDate, time: TomlLocalTime);
        date: TomlLocalDate;
        time: TomlLocalTime;
        toString(): string;
        toJSON(): string;
    }
    namespace _default {
        export { parse };
        export { stringify };
        export { TomlLocalDate };
        export { TomlLocalTime };
        export { TomlLocalDateTime };
    }
    export default _default;
    export type TableMeta = {
        declared: boolean;
        closed: boolean;
    };
}
```

<!-- GENERATED: ORO_API_REFERENCE_END -->

## See also

- [JavaScript APIs overview](/runtime/docs/javascript/overview/)
- [All module specifiers](/runtime/docs/javascript/all-modules/)
