#json-toml #query-string #yaml #toml #csv #json #yaml-format

app recast

Transforms one serialization format into another

7 releases

0.1.6 Feb 1, 2023
0.1.5 Dec 31, 2022

#657 in Filesystem

Download history 42/week @ 2024-02-22 25/week @ 2024-02-29

67 downloads per month

MIT license

13KB
211 lines

Recast

Transforms one serialization format into another. Available serialization formats include:

  • JSON (application/json)
  • TOML (application/toml)
  • Yaml (text/x-yaml)
  • Query strings
  • CSV (text/csv)
  • XML (text/xml)

Installation

Package manager Command
Cargo cargo install recast

The releases page contains pre-compiled releases and shell completion files

Usage

Transforms one serialization format into another

Usage: recast [OPTIONS] [FILE]

Arguments:
  [FILE]  Input from file

Options:
  -f, --from <FORMAT>  Input format [default: json] [possible values: json, toml, yaml, query, csv, xml]
  -t, --to <FORMAT>    Output format [default: json] [possible values: json, toml, yaml, query, csv, xml]
  -o, --out <FILE>     Output to file
  -h, --help           Print help information (use `--help` for more detail)
  -V, --version        Print version information

Examples

jq

Leverage jq's powerful filters on other serialization formats

$ recast -f toml Cargo.lock \
  | jq '.package | map({name: .name, version: .version}) | sort_by(.name)' \
  | recast -t csv \
  | head -n 5
name,version
addr2line,0.19.0
adler,1.0.2
autocfg,1.1.0
backtrace,0.3.67

Syntax highlighting

recast doesn't provide syntax highlighting, but you can leverage other cli tools like bat for this purpose

recast -f toml Cargo.toml | bat --language json

Dependencies

~11MB
~200K SLoC