.\" Man page generated from reStructuredText. . .TH JGREP 1 "2020" "" "" .SH NAME jgrep \- Command line tool and API for parsing JSON documents based on logical expressions . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .SH SYNOPSIS .nf jgrep [options] .fi .sp .SH DESCRIPTION .sp jgrep can be used for filtering the contents of a JSON (JavaScript Object Notation) file after having parsed it. The expressions can help testing for the presence or absence of certain elements in the file. They can also test the values of certain elements. .SH OPTIONS .nf \fB\-s\fP | \fB\-\-simple\fP .in +2 Greps the JSON and only returns the value of the field(s) specified .in -2 .fi .sp .nf \fB\-c\fP | \fB\-\-compat\fP .in +2 Returns the JSON in its non\-pretty flat form .in -2 .fi .sp .nf \fB\-n\fP | \fB\-\-stream\fP .in +2 Specify continuous input .in -2 .fi .sp .nf \fB\-f\fP | \fB\-\-flatten\fP .in +2 Flatten the results as much as possible .in -2 .fi .sp .nf \fB\-i\fP | \fB\-\-input\fP .in +2 Target JSON file to use as input. If this option is not specified, jgrep will expect to find JSON content on the standard input. .in -2 .fi .sp .nf \fB\-q\fP | \fB\-\-quiet\fP .in +2 Quiet; don\(aqt write to stdout. Exit with zero status if match found. .in -2 .fi .sp .nf \fB\-v\fP | \fB\-\-verbose\fP .in +2 Verbose output that will list a document if it fails to parse .in -2 .fi .sp .nf \fB\-\-start\fP .in +2 Starts the grep at a specific key in the document .in -2 .fi .sp .nf \fB\-\-slice\fP .in +2 A range of the form \(aqn\(aq or \(aqn..m\(aq, indicating which documents to extract from the final output .in -2 .fi .sp .SH EXPRESSIONS .sp JGrep uses the following logical symbols to define expressions. .nf \fBand\fP .in +2 \fI[statement] and [statement]\fP Evaluates to true if both statements are true .in -2 .fi .sp .nf \fBor\fP .in +2 \fI[statement] and [statement]\fP Evaluates true if either statement is true .in -2 .fi .sp .nf \fBnot\fP | \fB!\fP .in +2 \fI! [statement]\fP \fInot [statement]\fP Inverts the value of statement .in -2 .fi .sp .nf \fB+\fP .in +2 \fI+[value]\fP Returns true if value is present in the json document .in -2 .fi .sp .nf \fB\-\fP .in +2 \fI\-[value]\fP Returns true if value is not present in the json doument .in -2 .fi .sp .nf \fB(\fP and \fB)\fP .in +2 \fI(expression1) and expression2\fP Performs the operations inside the perentheses first. .in -2 .fi .sp .SH STATEMENTS .sp A statement is defined as some value in a JSON document compared to another value. .sp Available comparison operators are \fB=\fP, \fB<\fP, \fB>\fP, \fB<=\fP and \fB>=\fP .SH EXAMPLES .sp Given the following JSON document: .INDENT 0.0 .INDENT 3.5 \fI{"foo":1, "bar":null}\fP .UNINDENT .UNINDENT .sp the following are examples of valid expressions: .nf \fI+foo\fP .in +2 returns true .in -2 .fi .sp .nf \fI\-bar\fP .in +2 returns false .in -2 .fi .sp .nf \fI+foo and !(foo=2)\fP .in +2 returns true .in -2 .fi .sp .nf \fI!(foo>=2 and bar=null) or !(bar=null)\fP .in +2 returns true .in -2 .fi .sp .SH AUTHOR Gabriel Filion .\" Generated by docutils manpage writer. .