#json #dsl #generator #cli #tool #output #dsl-text

app json-generator

CLI tool to generate JSON from simple DSL

7 releases

0.1.6 Jul 31, 2019
0.1.5 Jul 30, 2019

#144 in #dsl

21 downloads per month

MPL-2.0 license

8KB
81 lines

Json Generator

Installation

After you have installed rustup.

$ cargo install json-generator

Usage

$ jg -h

jg 0.1.3
Timothy Bess <tdbgamer@gmail.com>
Takes in JSON DSL and outputs correctly formatted JSON

USAGE:
    jg [FLAGS] <dsl_text>

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

ARGS:
    <dsl_text>    

Simple ES Query

$ jg -p 'query=bool=must=[match=foo=bar, match=bar=200]' 
{
  "query": {
    "bool": {
      "must": [
        {
          "match": {
            "foo": "bar"
          }
        },
        {
          "match": {
            "bar": 200
          }
        }
      ]
    }
  }
}

Objects

$ jg -p 'a=b c=d d=e e=f'
{
  "a": "b",
  "c": "d",
  "d": "e",
  "e": "f"
}

Arrays

$ jg -p '[a, b, c, d, e, f]'
[
  "a",
  "b",
  "c",
  "d",
  "e",
  "f"
]

Numbers

$ jg -p '[1, 1.1, 1.2e10, -100]'
[
  1,
  1.1,
  12000000000.0,
  -100
]

Dependencies

~7MB
~133K SLoC