Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/altair-bueno/recast
Transforms one serialization format into another
https://github.com/altair-bueno/recast
cli csv json querystring rust toml xml yaml
Last synced: 3 months ago
JSON representation
Transforms one serialization format into another
- Host: GitHub
- URL: https://github.com/altair-bueno/recast
- Owner: Altair-Bueno
- License: mit
- Created: 2022-12-29T18:06:18.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2024-06-01T14:14:15.000Z (8 months ago)
- Last Synced: 2024-10-12T07:51:46.040Z (4 months ago)
- Topics: cli, csv, json, querystring, rust, toml, xml, yaml
- Language: Rust
- Homepage: https://crates.io/crates/recast
- Size: 33.2 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Recast
Transforms one serialization format into another. Available serialization
formats include:- JSON (`application/json`)
- TOML (`application/toml`)
- Yaml (`text/x-yaml`)
- [Query strings](https://github.com/ljharb/qs)
- CSV (`text/csv`)
- XML (`text/xml`)## Installation
| Package manager | Command |
| --------------- | ---------------------- |
| Cargo | `cargo install recast` |The [releases page](https://github.com/Altair-Bueno/recast/releases) contains
pre-compiled releases and shell completion files## Usage
```text
Transforms one serialization format into anotherUsage: recast [OPTIONS] [FILE]
Arguments:
[FILE] Input from fileOptions:
-f, --from Input format [default: json] [possible values: json, toml, yaml, query, csv, xml]
-t, --to Output format [default: json] [possible values: json, toml, yaml, query, csv, xml]
-o, --out Output to file
-h, --help Print help information (use `--help` for more detail)
-V, --version Print version information
```## Examples
## [jq](https://stedolan.github.io/jq/)
Leverage jq's powerful filters on other serialization formats
```sh
$ 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](https://github.com/sharkdp/bat) for this purpose```sh
recast -f toml Cargo.toml | bat --language json
```