diff --git a/CHANGELOG.md b/CHANGELOG.md index 94a0c30..aeb562d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,3 +19,8 @@ ## 0.5.0 - Released 2020-07-15 - Detailed documentation available at https://thomasebsmith.github.io/json-quick. + +## 0.6.0 - Released 2020-07-20 + - Selection syntax + - "Select" command allows selection of a subset of JSON input based on + property names, indices, and more. diff --git a/docs/index.md b/docs/index.md index 1ff8587..168c2ca 100644 --- a/docs/index.md +++ b/docs/index.md @@ -16,6 +16,7 @@ for more detailed instructions. the following commands are available: - [`help`](#help-command) - Displays usage and version information. - [`prettify`](#prettify-command) - Pretty-prints any JSON given as input. + - [`select`](#select-command) - Selects a subset of JSON given as input. - [`verify`](#verify-command) - Verifies that and JSON given as input is specification-conformant. @@ -36,9 +37,26 @@ Pretty-prints any JSON given as input. Currently, this command always indents with two spaces. However, options to customize indentation will be available in the future. +## Select Command +Selects a subset of the JSON that is given as input. Uses +[selection syntax](#selection-syntax) for patterns. + +Options: + - `--pattern `, `-p `: Selects using **. If no + pattern is specified, the entire JSON object is selected. + ## Verify Command Ensures that its input is valid JSON (conformant to the official specification). Returns with a zero exit code and prints "Valid JSON" to output if the JSON is valid. Returns with a non-zero exit code and prints an error to stderr if the JSON is not valid. + +## Selection Syntax +To select part of a JSON object, you can use dot-separated parts. Each part +can be a double-quoted property name, a non-quoted property name, or an +asterisk, which matches all property names. + +For example, the syntax `my_property."a.key".0"` would select an object's +`my_property` property, then the `a.key` property of that object, and finally +the first element of that array. diff --git a/json-quick.cabal b/json-quick.cabal index 428b225..f41ea68 100644 --- a/json-quick.cabal +++ b/json-quick.cabal @@ -1,7 +1,7 @@ cabal-version: 2.4 name: json-quick -version: 0.5.0.0 +version: 0.6.0.0 synopsis: A fast command-line utility for dealing with JSON homepage: https://github.com/thomasebsmith/json-quick bug-reports: https://github.com/thomasebsmith/json-quick/issues