#cli #toml #json

app toml2json

Convert TOML to JSON

6 releases (stable)

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

#372 in Encoding

Download history 31/week @ 2022-06-08 18/week @ 2022-06-15 29/week @ 2022-06-22 48/week @ 2022-06-29 33/week @ 2022-07-06 45/week @ 2022-07-13 30/week @ 2022-07-20 56/week @ 2022-07-27 34/week @ 2022-08-03 31/week @ 2022-08-10 38/week @ 2022-08-17 36/week @ 2022-08-24 13/week @ 2022-08-31 16/week @ 2022-09-07 3/week @ 2022-09-14 17/week @ 2022-09-21

55 downloads per month

MIT license

6KB
54 lines

toml2json

Build Status Crates.io

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

Installation

$ cargo 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

~2.4–3.5MB
~66K SLoC