Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,19 @@ We'll use the following JSON data for the examples:

Print an object's keys:

$ echo "$JSON" | jt ?
$ echo "$JSON" | jt @
foo
bar
baz

Print a nested object's keys:

$ echo "$JSON" | jt bar ?
$ echo "$JSON" | jt bar @
x

Print the keys of the first object in a nested array:

$ echo "$JSON" | jt baz ?
$ echo "$JSON" | jt baz @
y

Print the indexes in a nested array:
Expand Down
8 changes: 4 additions & 4 deletions jt.1.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ The following commands are available:
Print the array index at the top of the index stack. It is an error if the
index stack is empty.

* `?`:
* `@`:
Print the keys of the object at the top of the data stack. It is an error
if the item at the top of the data stack is not an object.

Expand Down Expand Up @@ -167,19 +167,19 @@ We will use the following JSON input for the examples:

Explore JSON data, print an object's keys:

$ echo "$JSON" | jt ?
$ echo "$JSON" | jt @
foo
bar
baz

Print a nested object's keys:

$ echo "$JSON" | jt bar ?
$ echo "$JSON" | jt bar @
x

Print the keys of the first object in a nested array:

$ echo "$JSON" | jt baz ?
$ echo "$JSON" | jt baz @
y

Print the indexes in a nested array:
Expand Down
4 changes: 2 additions & 2 deletions jt.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ int run(char *js, int argc, char *argv[]) {

if (argc <= 0) return 0;

if (! strcmp(argv[0], "?")) {
if (! strcmp(argv[0], "@")) {
if (data && data->type == JSMN_OBJECT)
obj_print_keys(js, data);
exit(0);
Expand Down Expand Up @@ -428,7 +428,7 @@ void usage(int status) {
fprintf(stderr, " jt -u <string>\n");
fprintf(stderr, " jt -c [-js] [-i <file>] [-o <file>] COMMAND ...\n");
fprintf(stderr, " jt [-js] [-i <file>] [-o <file>] [-F <char>] [-R <char>] COMMAND ...\n\n");
fprintf(stderr, "Where COMMAND is one of `[', `]', `%%', `?', `^', or a property name.\n");
fprintf(stderr, "Where COMMAND is one of `[', `]', `%%', `@', `^', or a property name.\n");
exit(status);
}

Expand Down