Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

This branch is 38 commits behind ploubser:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
lib
spec
README
jgrep.gemspec

README

JGrep usage : foo.json | jgrep "foo.bar=1"

Installation:

gem install jgrep

Flags:
-s [document field] : Greps the json and only returns the value of the field specified

Statements:

A statement is defined as some value in a json document compared to another value.
Available comparison operators are '=', '<', '>', '<=', '>='

Example: foo.bar=1

Complex statements:

Statements can be combined to form logical sentences. Order of precedence can be set with '(' and ')'
Available logical operaters are 'and', 'or', '!'.

Example: !(foo.bar=1) and (foo=bar)

In document comparison:

If a document contains an array, the '[' and ']' operators can be used to define a comparison where
statements are checked for truth on a per element basis.

Example: [bar1=1 and bar2=2]

on [{"foo":[{"bar1":1}, {"bar2":2}]},{"foo":[{"bar1":0}, {"bar2":0}]}]

will return

{foo:[bar1:1,bar2:2]}

Note: In document comparison cannot be nested.
Something went wrong with that request. Please try again.