Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow variable refs as object keys {$key:value}
Users are often surprised by the requirement to parenthesize any non-trivial object key expressions in object constructors. E.g., {"a"+"b":1}. This commit adds one more kind of key expression besides literals and idents: variable references. A common use case for this is jq programs as JSON templates to fill in with variables computed from inputs or passed in on the command-line. E.g., {some_key:$value}. Now users can also use, e.g., {$key:$value}. This and the restrictions on key and value expressions in object constructors are now clarified a bit in the documentation.
- Loading branch information