jkit cut
Fold deeply nested JSON into compact summaries. Perfect for getting an overview of a giant API response without scrolling for an hour.
bash
jkit cut <depth> # full name
jkit c <depth> # short aliasSynopsis
jkit cut [<depth>]
jkit c [<depth>]| Argument | Description |
|---|---|
<depth> | Maximum depth to render. Anything deeper is replaced with a one-line summary. Optional — when omitted, nothing is folded. |
Reads from stdin or the clipboard — see Input handling.
What it does
- Renders objects and arrays normally up to
<depth>levels. - At
<depth>, replaces nested objects with{ N items dict }and arrays with[ N items array ]. - Object keys are emitted in lexicographic order, so the same input always produces the same output. Diffing two payloads stays clean.
Examples
Depth = 0: collapse everything
bash
> echo '{"a":1,"b":[2,3]}' | jkit c 0
{ 2 items dict }Depth = 1: see the top-level shape
bash
> echo '{"meta":{"a":1,"b":2},"items":[1,2,3]}' | jkit c 1
{
"items": [ 3 items array ],
"meta": { 2 items dict }
}Depth = 2: drill one level deeper
bash
> echo '{"code":0,"message":"success","result":{"main_section":{"id":1,"title":"x"},"section":[{"id":2}]}}' | jkit c 2
{
"code": 0,
"message": "success",
"result": {
"main_section": { 2 items dict },
"section": [ 1 items array ]
}
}No argument: full tree, sorted keys
bash
> echo '{"b":1,"a":2,"c":3}' | jkit c
{
"a": 2,
"b": 1,
"c": 3
}Errors
bash
> echo '{}' | jkit c abc
jkit: invalid depth "abc": strconv.Atoi: parsing "abc": invalid syntax
> echo '{}' | jkit c -1
jkit: depth must be non-negative, got -1