Comments (10)
@theoreticaLee you can use keys with slashes, but you'll have to use explicit strings as the keys:
jq '.slash/key'
won't work, but jq '.["slash/key"]'
will.
jq '{slash/key}'
won't work, but jq '{"slash/key"}'
will.
from jq.
You can use the following syntax:
jq '.feed.entry[] | {"group": .["media$group"]}'
The {foo}
syntax is shorthand for this, but you need to use the longhand version if there are unusual characters in the field name.
from jq.
Now (if you build master) you can use:
jq '.feed.entry[] | {"media$group"}'
from jq.
@theoreticaLee you can use keys with slashes, but you'll have to use explicit strings as the keys:
jq '.slash/key'
won't work, butjq '.["slash/key"]'
will.
jq '{slash/key}'
won't work, butjq '{"slash/key"}'
will.
honestly love that one : just so useful today, using hashicorp vault api...
from jq.
None of the above solutions worked, I had to generate a jqparams.txt file using a "heredoc" and put environment variables in it, then pass that using jq --from-file jqparams.txt.
Would be nice to see this program play better with bash
primitives.
from jq.
For what it's worth, to access a sub-element where the sub-key has a slash:
jq '.devDependencies."@angular/cli"' package.json
from jq.
Along the same lines - I'm getting errors when the keys I'm trying to query for have '.' or ':' in them - ie/ 'foo.bar.baz:8008' is a key I'm trying to pull out out some JSON.
from jq.
ok, thanks for your answer
from jq.
Yeah, it would be great to add in escaping ability. I'm running into trouble with facebook's api as some results have keys with forward slash in them :/
from jq.
@Jean-Baptiste-Lasselle I'm dealing with the same thing, in the list of accessors at sys/auth
from jq.
Related Issues (20)
- select duplicates the input when iterator is used in the argument HOT 10
- Assertion failure when using --jsonargs with invalid JSON and printing $ARGS
- Finding unused accountid HOT 1
- Get links of the latest version of the theme from gnome-look.org HOT 3
- Formatting options
- No (documented) shorthand way to copy nested objects in Object Construction HOT 3
- Merge 2 jsons discarding the difference in specific key value HOT 1
- Installation under WSL HOT 1
- FAQ have obsolete link for jq.alhur.es/finder/ HOT 1
- --exit-status returns 0 for empty string when trying to expand array and selecting for value HOT 1
- Deleting objects using walk has side effects HOT 5
- Editor Bindings for Gedit/GtkSourceView HOT 1
- Opaque logging when "make check" tests fail HOT 2
- Provide linux/arm64 binaries in GitHub releases
- [Feature request] A raw, non-stdout output channel HOT 3
- jqlang org icon
- Define jqlang/jq <-> stedolan/jq relationship HOT 21
- builtins: Add lazy generator versions of `add/0`: `add/1` and `add/2`
- Can't get jq to install. HOT 7
- [Feature request] Make jq warn you on non-unique keys
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jq.