Giter Club home page Giter Club logo

jsonify's Introduction

jsonify

Some reasons why you might be interested:

  • Quickly produce JSON output based on command line arguments
  • Simple syntax to interpret values as strings or arbitrary JSON values
  • Supports reading file contents for easy escaping

Installation

  • Downloads are available from the Releases section.
  • go get github.com/fgeller/jsonify && go install github.com/fgeller/jsonify
  • Via homebrew on OSX: brew tap fgeller/tap && brew install jsonify

Usage

jsonify [[-|=]name value]...

Converts arguments into JSON output.

Details

  • -name causes the value to be interpreted as a string.
  • =name causes the value to be interpreted as a JSON value.
  • If the value is a valid file path, it's contents are used as the value.

Examples

$ # basic value types, ie - vs =
$ jsonify -name hans =age 23 =subscribed true =address null | jq
{
  "address": null,
  "age": 23,
  "name": "hans",
  "subscribed": true
}

$ # nested objects via command substitution
$ jsonify =a `jsonify -name hans` =b `jsonify -name peter` | tee outfile | jq
{
  "a": {
    "name": "hans"
  },
  "b": {
    "name": "peter"
  }
}

$ # subshell output as a value to get current date
$ # reading contents of "outfile" from previous invocation
$ jsonify -date "$(date)" =content outfile | jq
{
  "content": {
    "a": {
      "name": "hans"
    },
    "b": {
      "name": "peter"
    }
  },
  "date": "Thu Mar 17 19:10:04 NZDT 2016"
}

jsonify's People

Contributors

fgeller avatar

Stargazers

 avatar Peter Downs avatar Charles  Cianos (Charlie) avatar Andrew Gerst avatar Tsiry Sandratraina avatar Arbal avatar GAURAV avatar Samuel Chase avatar  avatar Manuel Durán Aguete avatar ricardoe avatar James Mills avatar Sylwester Lachiewicz avatar Abdurrachman M avatar Pavel Marakhovsky avatar chennqqi avatar Chris Seaton avatar Andy avatar Charlie Smith avatar Christian Stefanescu avatar Elias Levy avatar Zhao Xiaohong avatar Timothy Spann avatar Peter Linde avatar James Brunskill avatar Nazeeruddin Ikram avatar

Watchers

 avatar James Mills avatar  avatar

Forkers

mkokho ccianos

jsonify's Issues

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.