Skip to content

timbess/json-generator-rs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
]

About

JSON generator CLI based on small DSL

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages