Giter Site home page Giter Site logo

nessex / yaml2json-rs Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 1.0 142 KB

Command line utility (+libraries) to convert YAML to JSON.

License: Apache License 2.0

Dockerfile 1.13% Rust 89.22% Shell 9.65%
yaml2json cli cli-app utility rust rust-crates library rust-library crates

yaml2json-rs's Introduction

yaml2json-rs

Docker Cloud Build Status GitHub release (latest SemVer) Crates.io

yaml2json-rs converts one or more YAML documents into a JSON stream.

There are many implementations of this idea, with various limitations. This one aims for:

  • Speed
  • Multi-document support
  • Error control
    • selectively silence errors or output errors as JSON

This implementation relies heavily on the existing work in Serde, yaml-rust and others to provide fast and correct serialization and deserialization. In naïve tests, this provided a significant speed improvement over other implementations, though your mileage may vary.

Installation

Download pre-compiled binaries from the Releases Page.

Or, install via cargo:

cargo install yaml2json-rs-bin --bin yaml2json

Or, quickly try it out with docker:

echo "hello: world" | docker run -i nessex/yaml2json-rs:master

Usage

Utility to convert YAML files to JSON

USAGE:
    ./yaml2json file1.yaml file2.yaml

    cat file1.yaml | ./yaml2json

    ./yaml2json --error=json file1.yaml | jq

FLAGS:
    -h, --help       Prints help information
    -p, --pretty     
    -V, --version    Prints version information

OPTIONS:
    -e, --error <error>     [default: stderr]  [possible values: silent, stderr, json]

ARGS:
    <file>...    Specify the path to files you want to convert. You can also pass files via stdin instead.

For best results when dealing with multiple documents, pass multiple files in at once by path:

# Be sure to use + and not \; with find
find . -name '*.yaml' -exec yaml2json {} +

Crates

crate links description
yaml2json-rs-bin A command line utility to convert YAML to JSON
yaml2json-rs yaml2json-rs docs A library wrapping serde-yaml and serde-json to convert a single YAML document to JSON
yaml-split yaml2json-rs docs A library providing an iterator over individual YAML documents within a YAML file or stream

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Support

Please consider supporting the amazing libraries that make this work:

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.