GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - featherbread/xt: Translate between JSON, MessagePack, TOML, and YAML

BranchesTags
Open more actions menu

Latest commit

 

History

897 Commits
897 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
benches
benches
 
 
doc
doc
 
 
fuzz
fuzz
 
 
src
src
 
 
tests
tests
 
 
.git-blame-ignore-revs
.git-blame-ignore-revs
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
CHANGELOG.md
CHANGELOG.md
 
 
Cargo.lock
Cargo.lock
 
 
Cargo.toml
Cargo.toml
 
 
LICENSE.txt
LICENSE.txt
 
 
Makefile
Makefile
 
 
README.md
README.md
 
 
about.hbs
about.hbs
 
 
about.toml
about.toml
 
 
clippy.toml
clippy.toml
 
 
rustfmt.toml
rustfmt.toml
 
 

Repository files navigation

xt

xt is a cross-format translator for JSON, MessagePack, TOML, and YAML.

For example, you can process a set of TOML files with jq:

$ xt a/Cargo.lock b/Cargo.lock | jq -r '.package[].name' | sort -u
aho-corasick
anes
autocfg
# etc.

Or transform a JSON configuration file into YAML for easier editing:

$ xt -t yaml config.json > config.yaml

Or store an unbounded stream of JSON events as MessagePack to save space:

$ curl localhost:8001/apis/events.k8s.io/v1/events?watch | xt -tm > events.msgpack

Installation

xt is written in Rust to leverage the powerful Serde ecosystem of data serialization and deserialization libraries.

After installing Rust on your system, you can install xt from crates.io using Cargo:

cargo install --locked xt

NetBSD

On NetBSD a pre-compiled binary is available from the official repositories. To install it, simply run:

pkgin install xt-rs

Homebrew

On Linux and macOS, the pre-compiled binaries in this repo's GitHub releases can be installed with Homebrew:

brew install featherbread/tap/xt

Usage and Features

xt [-f format] [-t format] [file ...]

Or, run xt --help for full usage information.

xt is built to "do one thing well," and tries to maintain a minimal interface and feature set. The most common options are -t to specify an output format other than JSON, and one or more files to read from rather than standard input.

Some of xt's notable features include:

Automatic Format Detection

When the input format is not specified with the -f option, xt can detect it automatically by file extension, or by examining the content of the input stream itself.

Multi-Document Support

With most output formats, xt can translate multiple input files, each containing one or more independent documents, to a single output stream. For example, a set of YAML files with documents separated by --- markers can translate to a single stream of newline-delimited JSON objects. With format detection enabled, xt can even translate input files in different formats to a single output.

Streaming Translation

xt can translate multi-document inputs from unbounded sources like shell pipes with minimal buffering, while still supporting features like automatic format detection. Streaming is enabled automatically whenever it's required.

License

xt is released under the terms of the MIT License. See LICENSE.txt for more information.

About

Translate between JSON, MessagePack, TOML, and YAML

crates.io/crates/xt

Topics

jsonmessagepackrustserdetomlyaml

Resources

Readme
MIT license
Activity

Stars

9 stars

Watchers

1 watching

Forks

2 forks
Report repository

Releases

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.