#cli #toml #json

app toml2json

Convert TOML to JSON

8 releases (5 stable)

1.3.1 Aug 5, 2023
1.3.0 Jan 2, 2022
1.2.0 Aug 26, 2021
1.0.0 Mar 17, 2021
0.9.12 Mar 17, 2021

#625 in Encoding

Download history 29/week @ 2023-11-04 39/week @ 2023-11-11 36/week @ 2023-11-18 31/week @ 2023-11-25 54/week @ 2023-12-02 18/week @ 2023-12-09 23/week @ 2023-12-16 49/week @ 2023-12-23 18/week @ 2023-12-30 12/week @ 2024-01-06 26/week @ 2024-01-13 24/week @ 2024-01-20 52/week @ 2024-01-27 18/week @ 2024-02-03 34/week @ 2024-02-10 123/week @ 2024-02-17

229 downloads per month

MIT license

8KB
55 lines

toml2json

CI Crates.io

A command-line tool that converts TOML to JSON. Nothing more, nothing less.

Installation

Cargo

$ cargo install toml2json

Nixpkgs

nix-env --install toml2json

Please let us know if you package toml2json for another package manager or ecosystem!

Usage

Convert TOML on stdin to JSON, filtering it through jq:

$ toml2json <<< 'wow = "amazing"' | jq

Produces:

{
  "wow": "amazing"
}

Convert TOML from a file and pretty-print it without jq:

$ toml2json --pretty ~/.config/kbs2/kbs2.conf

Produces:

{
  "age-backend": "RageLib",
  "error-hook": "~/.config/kbs2/hooks/error-hook-notify",
  "keyfile": "REDACTED-GO-AWAY",
  "public-key": "REDACTED-GO-AWAY",
  "reentrant-hooks": false,
  "store": "~/.kbs2-store",
  "wrapped": true,
  "generators": [
    {
      "alphabet": "abcdefghijklmnopqrstuvwxyz0123456789(){}[]-_+=",
      "length": 16,
      "name": "default"
    }
  ],
  "commands": {
    "edit": {
      "editor": "subl -w",
      "post-hook": "~/.config/kbs2/hooks/push-repo"
    },
    "new": {
      "generate-on-empty": true,
      "post-hook": "~/.config/kbs2/hooks/push-repo"
    },
    "pass": {
      "clear-after": true,
      "clear-hook": "~/.config/kbs2/hooks/pass-clear-notify",
      "clipboard-duration": 10,
      "x11-clipboard": "Clipboard"
    },
    "rm": {
      "post-hook": "~/.config/kbs2/hooks/push-repo"
    }
  }
}

Amazing. What more could you want? Hopefully nothing, because it will never do anything else.

Dependencies

~1.9–2.7MB
~54K SLoC