json-generator

Crates.iojson-generator
lib.rsjson-generator
version0.1.6
sourcesrc
created_at2019-07-30 17:30:30.109285
updated_at2019-07-31 03:42:10.397077
descriptionCLI tool to generate JSON from simple DSL
homepage
repositoryhttps://github.com/tdbgamer/json-generator-rs
max_upload_size
id153007
size22,011
Timothy Bess (tdbgamer)

documentation

README

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
]
Commit count: 14

cargo fmt