Skip to content

Commit

Permalink
Added description of -ijq
Browse files Browse the repository at this point in the history
  • Loading branch information
noborus committed May 24, 2021
1 parent 35db53a commit 34f83d2
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -469,26 +469,17 @@ menu.json
}
```

Normally it is a 1 column table as it is.

```console
trdsql -oat 'SELECT * FROM menu.json'
```

```
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| menu |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| {"id":"file","popup":{"menuitem":[{"onclick":"CreateDoc()","value":"New"},{"onclick":"OpenDoc()","value":"Open"},{"onclick":"SaveDoc()","value":"Save"}]},"value":"File"} |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
```

You can write a jq expression by connecting :: after the json file name.
Enclose the jq expression in double quotes if needed.

```console
trdsql -oat 'SELECT value, onclick FROM menu.json::".menu.popup.menuitem"'
```
Or specify with the `-ijq` option.

```console
trdsql -oat -ijq ".menu.popup.menuitem" "SELECT * FROM menu.json"
```

```
+-------+-------------+
Expand Down

0 comments on commit 34f83d2

Please sign in to comment.