JSON update tool -- a command line JSON swiss army knife.
This is a command line filter utility that may be used to manipulate JSON documents, merge JSON documents with JSON and non-JSON formats, or create new JSON documents.
It is a swiss army knife to query and manipulate JSON.
This project is a standard GNU
autotools
project. Build and install instructions are available in the INSTALL
file provided with GNU autotools.
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install
The basic usage is that of a filter. The basic sequence is,
- Provide input via stdin.
jup
reads input into memory.jup
modifies input via a sequence of edit commands.- Provide pretty-printed output to stdout (unless
--min
is specified).
$ ./jup --list-short
[
"array JSON-PATH",
"false JSON-PATH",
"file.base64 JSON-PATH FILE",
"file.csv JSON-PATH FILE",
"file.hex JSON-PATH FILE",
"file.json JSON-PATH FILE",
"file.text JSON-PATH FILE",
"get JSON-PATH",
"int JSON-PATH VALUE",
"new",
"newarray",
"null JSON-PATH",
"num JSON-PATH VALUE",
"object JSON-PATH",
"set JSON-PATH VALUE",
"str JSON-PATH VALUE",
"true JSON-PATH"
]
$ ./jup --list-commands
[
{
"command": "array",
"usage": "array JSON-PATH",
"help": "Store empty array at JSON-PATH"
},
{
"command": "false",
"usage": "false JSON-PATH",
"help": "Store boolean false at JSON-PATH"
},
{
"command": "file.base64",
"usage": "file.base64 JSON-PATH FILE",
"help": "Store (binary?) base64-encoded content of FILE at JSON-PATH"
},
{
"command": "file.csv",
"usage": "file.csv JSON-PATH FILE",
"help": "Decode and store CSV-formatted content of FILE at JSON-PATH"
},
{
"command": "file.hex",
"usage": "file.hex JSON-PATH FILE",
"help": "Store (binary?) hex-encoded content of FILE at JSON-PATH"
},
{
"command": "file.json",
"usage": "file.json JSON-PATH FILE",
"help": "Store content of JSON FILE at JSON-PATH"
},
{
"command": "file.text",
"usage": "file.text JSON-PATH FILE",
"help": "Store content of FILE at JSON-PATH"
},
{
"command": "get",
"usage": "get JSON-PATH",
"help": "Replace document with subset of JSON input, starting at JSON-PATH"
},
{
"command": "int",
"usage": "int JSON-PATH VALUE",
"help": "Store integer VALUE at JSON-PATH"
},
{
"command": "new",
"usage": "new",
"help": "Create document with empty object. stdin ignored."
},
{
"command": "newarray",
"usage": "newarray",
"help": "Create document with empty array. stdin ignored."
},
{
"command": "null",
"usage": "null JSON-PATH",
"help": "Store null at JSON-PATH"
},
{
"command": "num",
"usage": "num JSON-PATH VALUE",
"help": "Store floating point VALUE at JSON-PATH"
},
{
"command": "object",
"usage": "object JSON-PATH",
"help": "Store empty object at JSON-PATH"
},
{
"command": "set",
"usage": "set JSON-PATH VALUE",
"help": "Store VALUE at JSON-PATH. Auto-detect value type."
},
{
"command": "str",
"usage": "str JSON-PATH VALUE",
"help": "Store VALUE at JSON-PATH"
},
{
"command": "true",
"usage": "true JSON-PATH",
"help": "Store boolean true at JSON-PATH"
}
]