| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The cmake logic is wrong (E.G. PKG_CHECK_FOR_MODULES fails unless all
modules are found), and the legacy libjson.so name is also used by the
other libjson (for example [1]) which provides an incompatible API,
so just drop it.
Backported from libubox cbf80de7f4df61960f386cb01a899cf4228d38f3
[1] http://sourceforge.net/projects/libjson/
Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
[ wrapped commit description to 75 char limit ]
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Introduce a new operator `~` and new `/.../eis` regular expression syntax.
This allows filtering by regular expression, e.g.
jsonfilter -s '[ "foo", "bar", "baz" ]' -e '$[@ ~ /^b/]'
... would yield the values `bar` and `baz`.
Possible regular expression modifiers are:
- `e` ... enable extended POSIX regular expressions
- `i` ... perform case insensitive matches
- `s` ... let ranges and `.` match the newline character
A regular expression literal may occur on the left or the right side of
the `~` operator, but not on both.
In case neither side of the `~` operator is a regular expression, the right
side will be treated as regular expression pattern. Non-string values are
converted to their string representation before performing matching.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
|
|
|
|
| |
A misplaced paren caused escape sequences in the ranges \x00..\x7f,
\u0000..\u007f and \0..\177 to get improperly encoded into the
string buffer.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
|
|
|
|
|
|
|
| |
Implement a new option "-a" which turns on array mode, meaning that
the program will attempt to parse multiple consecutive JSON objects
from the source data and merge them into a JSON array.
This is mainly useful for operating on JSON log files with one object
per line.
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
| |
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
|
|
| |
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
|
|
|
|
|
|
|
| |
Add a CMake FIND_PATH and INCLUDE_DIRECTORIES searching for
libubox/list.h. Some external toolchains which do not include standard
locations would fail to find the header otherwise.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
|
|
|
|
| |
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
| |
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
All a patch specification to be just '@' or '$' - this is mainly useful when
exporting the keys of the toplevel object to the shell.
Example:
$ echo '{ "abc": 1, "def": 2 }' | jsonpath -e 'keys=@'
export keys='abc'\ 'def';
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
|
|
|
|
|
|
|
|
| |
Add basic usage text to the binary and print it when invoked with -h
or with no arguments at all.
Signed-off-by: Karl Palsson <karlp@remake.is>
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
|
|
| |
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
|
|
| |
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
|
|
| |
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
|
|
|
|
|
|
| |
The new "-l" flag allows limiting the number of results getting printed.
This is useful for expressions which match many items when only the first
is desired.
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
|
|
| |
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
|
|
|
|
|
| |
This is useful to join values with a specified char instead of the
default space.
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Keep track of the exact location the error occured in and switch
the internal error description from a dynamic string buffer to an
integer which either holds negative values for lexer errors or
positives values for grammer violations.
In case of grammer violations the "error_code" member will hold
a bitfield describing the expected tokens.
Also rework the error messages emitted by the cli to be more
precise.
Examples:
$ jsonfilter -s '{}' -e '@.foo bar'
Syntax error: Expecting End of file
In expression @.foo bar
Near here ----------^
$ jsonfilter -s '{}' -e '@.foo\bar'
Syntax error: Unexpected character
In expression @.foo\bar
Near here ---------^
$ jsonfilter -s '{}' -e '@.foo..bar'
Syntax error: Expecting Label or '*'
In expression @.foo..bar
Near here ----------^
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
|
|
| |
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
|
|
|
|
|
|
|
|
|
| |
This commit drops the flex + bison code in favor to a hand-written
lexer and a new grammar file in lemon syntax.
The change results in a much smaller binary and easier to maintain
code. Code required to build and maintain the AST has been split
off into the ast.c and ast.h files.
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
|
|
|
| |
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
|
| |
|
| |
|
| |
|
|
|
|
| |
as more readable alternative to or expressions
|
| |
|
|
|
|
|
| |
- introduced callback argument in jp_match() which is invoked for each found json item
- when chaining strings or numbers in or expressions, implicitely match them against the current key
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* add -q flag to suppress error messages
* add -t flag to test type of result
* clean up exit codes to indicate success;
- 0 if all -t and -e expression yielded a result
- 1 if at least one -t or -e expression didn't match
- 125 when failed to open input file
- 126 when failed to parse json input
- 127 when the farser fails due to oom
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
files, clean generated headers
|
| |
|
|
|