Giter Club home page Giter Club logo

yj's Introduction

YJ - YAML to JSON

Build Status

Simple command line tool to convert a YAML input file into a JSON output file.

How to, etc.

Built in help

$ yj --help
yj 1.2.0

Command line tool that converts YAML to JSON

USAGE:
    yj [FLAGS] [OPTIONS] [INPUT]

ARGS:
    <INPUT>    Input YAML file name. Defaults to stdin

FLAGS:
    -c, --compact    Use compact formatting for the JSON output
    -h, --help       Print help information
    -j, --json       Parse the input as JSON. For most use cases, this option
                     makes no difference. Valid JSON is valid YAML, so JSON
                     input will (should?) parse correctly even when being
                     handled with the YAML parser. Use this option when you
                     want failure (instead of weird results) when the input is
                     invalid JSON
    -V, --version    Print version information
    -y, --yaml       Format the output as YAML instead of JSON

OPTIONS:
    -o, --output <OUTPUT>    Output file name for the JSON. Defaults to stdout

Installing

Local build and install with cargo:

$ cargo install yj

Prebuilt binaries are available on Github releases for some common platforms.

On macOS, the prebuilt binary can be installed using Homebrew. Unfortunately, Homebrew picked up a different utility with the name yj after I chose that name here. So, a simple brew install yj gets that tool, not this one ๐Ÿ˜ž.

$ brew tap bruceadams/utilities
$ brew install bruceadams/utilities/yj

Alternatively on macOS, you may also install yj using MacPorts:

$ sudo port selfupdate
$ sudo port install yj

Minimal Docker images are available on Docker Hub:

$ docker pull bruceadams/yj

Example runs

$ cat .travis.yml
language: rust
os:
  - linux
  - osx
  - windows
rust:
  - stable
  - beta
  - nightly
matrix:
  allow_failures:
    - rust: nightly
  fast_finish: true
$ yj .travis.yml
{
  "language": "rust",
  "os": [
    "linux",
    "osx",
    "windows"
  ],
  "rust": [
    "stable",
    "beta",
    "nightly"
  ],
  "matrix": {
    "allow_failures": [
      {
        "rust": "nightly"
      }
    ],
    "fast_finish": true
  }
}
$ echo pi: 3.1415926 | yj
{
  "pi": 3.1415926
}
$ echo pi: 3.1415926 | yj -c
{"pi":3.1415926}$

Build

Build it your self with Rust 2018, which needs a recent installation of Rust. Get Rust installed from https://rustup.rs/.

cargo build

yj's People

Contributors

bruceadams avatar dependabot-preview[bot] avatar dependabot[bot] avatar herbygillot avatar

Stargazers

 avatar

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.