Home

Awesome

jsonify

Some reasons why you might be interested:

Installation

Usage

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

Converts arguments into JSON output.

Details

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"
}