Monu Tools

JSON 转 TOML 转换器

完全在浏览器中,将 JSON 转为 TOML,也可将 TOML 转回 JSON,双向均可。

如何使用 JSON / TOML

  1. 01

    选择方向:JSON 转 TOML 或 TOML 转 JSON。

  2. 02

    粘贴你的 JSON 或 TOML。

  3. 03

    复制结果,或交换以转回。

A two-way JSON and TOML converter

This is a two-way converter between JSON and TOML. Pick a direction, paste your data, and copy the result. It is built on a well-tested TOML parser that handles nested tables and arrays of tables correctly.

Everything runs locally in your browser, so your data, which for config files can include hostnames or tokens, never leaves your device.

What TOML is for

TOML (Tom's Obvious, Minimal Language) is a configuration format designed to be obvious to read and to map cleanly onto a hash table. It is what Rust's Cargo uses for Cargo.toml and what Python projects use for pyproject.toml, among many others.

JSON and TOML: similar data, different jobs

JSON and TOML describe similar data but suit different jobs. JSON is the lingua franca for APIs and machine exchange. TOML is built for human-written config, with sections, comments and first-class dates that make a settings file pleasant to edit.

TOML also supports native date and time values and typed numbers, so values keep their meaning rather than all becoming strings, which is part of why it is preferred for configuration.

The one thing to watch: null values

Most data round-trips cleanly, but there is one catch. TOML has no null value. JSON nulls cannot be represented, so remove or replace them before converting to TOML, otherwise the conversion cannot express them.

常见问题

什么是 TOML?

TOML 是一种极简的配置格式,设计上易于阅读,被 Cargo 等工具以及许多 Python 项目在 pyproject.toml 中使用。

所有内容都能干净地转换吗?

大多数数据可以。TOML 没有 null,因此 JSON 的 null 无法表示;请在转换前移除或替换它们。

我的数据会被上传到任何地方吗?

不会。转换完全在你的浏览器中运行,因此你的数据永远不会离开你的设备。

来源

嵌入此工具

将此工具添加到你自己的网站。复制下方代码片段即可,它会自动保持最新。

<iframe src="https://monu.tools/embed/zh/json-toml-converter" width="100%" height="640" style="border:1px solid #e5e5e5;border-radius:12px;max-width:680px" loading="lazy" title="Monu Tools"></iframe>

相关工具