jql 0.1.4

A JSON query language CLI tool
jql-0.1.4 is not a library.
Visit the last successful build: jql-5.2.0

JQL

A JSON Query Language CLI tool

Installation 🚀

cargo install jql

Usage 🐨

If you find some of the following examples confusing, please have a look at The JavaScript Object Notation (JSON) Data Interchange Format.

Accessing the root

"This is a valid JSON text with one value"
jql example.json ''
"This is a valid JSON text with one value"

Please note that the following is also valid:

jql example.json '.'
"This is a valid JSON text with one value"

Accessing a children

{
  "some": {
    "property": "yay!"
  }
}
jql example.json '"some"."property"'
"yay!"

Please note that the following is also valid:

jql example.json 'some.property'
"yay!"

Accessing an index

{
  "primes": [7, 11, 13]
}
jql example.json 'primes.0'
7

Please note that the following is also valid:

jql example.json 'primes."0"'
7

Accessing a range

{
  "cats": [{ "first": "Pixie" }, { "second": "Kitkat" }, { "third": "Misty" }]
}
jql example.json 'cats.1:2'
[
  {
    "second": "Kitkat"
  },
  {
    "third": "Misty"
  }
]

Please note that you can reverse it:

jql example.json 'cats.2:1'
[
  {
    "third": "Misty"
  },
  {
    "second": "Kitkat"
  }
]

Bonus, you can do it again to get it back:

jql example.json 'cats.2:1.1:0'
[
  {
    "second": "Kitkat"
  },
  {
    "third": "Misty"
  }
]

Please note that you can still access the children:

jql example.json 'cats.2:1.0.third'
"Misty"

Special characters

{
  ".valid": 1337
}
jql example.json '".valid"'
1337

Help 📖

jql --help