Skip to content

petli-full/jq-vscode

Repository files navigation

jq-vscode

This extension allows users run jq queries in the editor. The result is displayed synchronously in the output.

Jq Version

This extension uses the latest 1.6 version of the jq processor.

Usage

  • Filter the currently active json doc by jq in a split editor: (Ctrl+Shift+P) and search "jq: open an ...".

filter json

  • Filter only the selected text.

filter selected text

Parsing non-standard JSON

In order to be processed by jq, the input json needs to be strictly valid. Nowadays it is common to have comments or other variations in json. In order to convert non-standard json inputs, one of the tools recommended by jq is any-json.

This extension integrates any-json as a utility command. It can be used to preprocess the input json text. Type ajson (an abbreviation of "any-json") before jq queries,

ajson.<input-file-format> |
<jq queries>

any-json

Command line options

Some of the useful jq command line options are supported, like --slurp, --sort-keys and so on. command-line-options