### Install JQL with Cargo Binstall Source: https://github.com/yamafaktory/jql/blob/main/README.md Install the JQL tool using Cargo Binstall, which can provide faster installations by downloading pre-compiled binaries. ```sh cargo binstall jql ``` -------------------------------- ### Install JQL with Cargo Source: https://github.com/yamafaktory/jql/blob/main/README.md Install the JQL tool using Cargo, Rust's package manager. This is a common method for Rust-based command-line tools. ```sh cargo install jql ``` -------------------------------- ### Pipe in operator example Source: https://github.com/yamafaktory/jql/blob/main/README.md Applies the next tokens in parallel on each element of an array. Use this to process array elements concurrently. ```json { "a": [{ "b": { "c": 1 } }, { "b": { "c": 2 } }] } ``` ```sh "a"|>'b''c' ``` ```json [1, 2] ``` -------------------------------- ### Truncate operator example Source: https://github.com/yamafaktory/jql/blob/main/README.md Maps the output into simple JSON primitives. Use this to simplify complex JSON structures to basic types. ```json { "a": [1, 2, 3] } ``` ```sh "a"! ``` ```json [] ``` -------------------------------- ### Valid JSON Keys Example Source: https://github.com/yamafaktory/jql/blob/main/README.md Demonstrates valid JSON keys, including an empty string and a key containing escaped double quotes. This highlights JQL's adherence to RFC 8259. ```json { ".valid": 1337, "": "yeah!", "\"": "yup, valid too!" } ``` -------------------------------- ### Pipe out operator example Source: https://github.com/yamafaktory/jql/blob/main/README.md Stops the parallelization initiated by the pipe in operator. Use this to consolidate results after parallel processing. ```json { "a": [{ "b": { "c": 1 } }, { "b": { "c": 2 } }] } ``` ```sh "a"|>'b''c'<|[1] ``` ```json 2 ``` -------------------------------- ### Get Keys of an Object or Indices of an Array Source: https://github.com/yamafaktory/jql/blob/main/README.md The keys operator returns an array of keys for an object or indices for an array. Other primitive types are returned as is. ```sh '@' ``` -------------------------------- ### Lens Selector with Value Assignment Source: https://github.com/yamafaktory/jql/blob/main/README.md Applies a lens selector to filter and transform JSON data. This example filters objects based on a nested key's value and selects another key. ```sh '|={\"b\"d\"=2, \"c\"}' ``` -------------------------------- ### List available JQL development commands Source: https://github.com/yamafaktory/jql/blob/main/README.md Displays all available commands defined in the justfile for development tasks. ```sh just --list ``` -------------------------------- ### Display JQL help information Source: https://github.com/yamafaktory/jql/blob/main/README.md Shows the help message for the JQL command, including usage and available options. ```sh jql -h ``` ```sh jql --help ``` -------------------------------- ### Accessing First Element of an Array with JQL Source: https://github.com/yamafaktory/jql/blob/main/PERFORMANCE.md Compares the performance of JQL's array indexing '[0]' against JQ's '.[] | {.[0]}' for accessing the first element of an array. Both commands process the same input. ```bash echo '[1, 2, 3]' | jq '.[0]' ``` ```bash echo '[1, 2, 3]' | jql '[0]' ``` -------------------------------- ### Extracting Multiple Fields from JSON Array with JQL Source: https://github.com/yamafaktory/jql/blob/main/PERFORMANCE.md Compares the performance of JQL's shorthand field extraction '|>{"field1", "field2"}' against JQ's complex mapping for extracting specific fields (name, url, language, stargazers_count, watchers_count) from a list of GitHub repositories. The JQ command uses a more verbose mapping, while JQL uses a concise syntax. ```bash cat /home/runner/work/jql/jql/assets/github-repositories.json | jq -r '[.[] | {name: .name, url: .url, language: .language, stargazers_count: .stargazers_count, watchers_count: .watchers_count}]' > /dev/null ``` ```bash cat /home/runner/work/jql/jql/assets/github-repositories.json | jql '|>{"name", "url", "language", "stargazers_count", "watchers_count"}' > /dev/null ``` -------------------------------- ### Build Array from Sub-queries Source: https://github.com/yamafaktory/jql/blob/main/README.md Constructs a JSON array by selecting specific keys from an object using a group separator query. The output is an array of the values corresponding to the specified keys. ```sh '"a","b","c"' ``` -------------------------------- ### Save JQL output to a file Source: https://github.com/yamafaktory/jql/blob/main/README.md Saves the result of a JQL query to a specified output file. Ensure the input JSON file exists. ```sh jql '"a"' input.json > output.json ``` -------------------------------- ### Flattening Nested Arrays with JQL Source: https://github.com/yamafaktory/jql/blob/main/PERFORMANCE.md Compares the performance of JQL's '..' operator for flattening nested arrays against JQ's 'flatten' function. Both commands process the same input. ```bash echo '[1, [2], [[3]]]' | jq 'flatten' ``` ```bash echo '[1, [2], [[3]]]' | jql '..' ``` -------------------------------- ### Extracting a Field from a JSON Object with JQL Source: https://github.com/yamafaktory/jql/blob/main/PERFORMANCE.md Compares the performance of JQL's field access '"foo"' against JQ's '.foo' for extracting a specific field from a JSON object. Both commands process the same input. ```bash echo '{ "foo": "bar" }' | jq '.foo' ``` ```bash echo '{ "foo": "bar" }' | jql '"foo"' ``` -------------------------------- ### Select Multiple Object Keys Source: https://github.com/yamafaktory/jql/blob/main/README.md Retrieves values for multiple specified keys from a JSON object. The output is a new object containing only the selected key-value pairs. ```sh '{"c","a"}' ``` -------------------------------- ### Read JQL query from stdin Source: https://github.com/yamafaktory/jql/blob/main/README.md Reads JSON data from standard input and processes it with a JQL query. Useful for piping data from other commands. ```sh cat test.json | jql '"a"' ``` -------------------------------- ### Select Array Elements by Index Source: https://github.com/yamafaktory/jql/blob/main/README.md Selects specific elements from a JSON array using an array of indices. The order of indices in the query determines the order of elements in the output array. ```sh '[2,1]' ``` -------------------------------- ### Select Object Elements by Index Source: https://github.com/yamafaktory/jql/blob/main/README.md Selects key-value pairs from a JSON object based on their insertion order using indices. The output is a new object with the selected pairs. ```sh '{2,0}' ``` -------------------------------- ### Select Object Value by Key Source: https://github.com/yamafaktory/jql/blob/main/README.md Retrieves the value associated with a specific key from a JSON object. ```sh '"c"' ``` -------------------------------- ### Select Object Range by Index Source: https://github.com/yamafaktory/jql/blob/main/README.md Selects a range of key-value pairs from a JSON object based on their insertion order. Supports natural, reversed, and open-ended ranges. ```sh '{2:1}' ``` -------------------------------- ### Select Array Range Source: https://github.com/yamafaktory/jql/blob/main/README.md Selects a range of elements from a JSON array. Supports natural, reversed, and open-ended ranges. ```sh '[2:1]' ``` -------------------------------- ### Flatten Nested Arrays and Objects Source: https://github.com/yamafaktory/jql/blob/main/README.md Recursively flattens nested arrays and objects into a single-level structure. For objects, keys are concatenated with dots. ```sh '..' ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.