4 ms·
I've been using it for over a year - especially with AWS CLI, but, I'm a little displeased that it only has the query feature (duh) and does not have a little m
by kolev 12y ago
I've been using it for over a year - especially with AWS CLI, but, I'm a little displeased that it only has the query feature (duh) and does not have a little more like merging JSONs (I think it only has appending). Another issue is that I wasn't able to find release notes for v1.4 - what's new since v1.3? There other similar tools, but they require node, Python packages, etc. jq really is installed with one command and no dependencies.
- lugg 12y agoYou should be able to do some pipe fu and carry out some form of merging via bash. I mostly use it for making our output more readable or producing CSV style reports with the filtered data. Its filters are probably the biggest feature, at least in my mind.
- kolev 12y agoSorry for not being clear. I meant a merge in the form of {"a": 1, "b": 2, "c": 3} merged with {"b": 20} returning {"a": 1, "b": 20, "c": 3}. Like Python's update() or PHP's array_replace_recursive() although PHP's a little richer.
- cryptonector 12y agojq 'reduce .[] as $obj ({}; .+$obj)' or jq -s 'reduce .[] as $obj ({}; .+$obj)' should do it. `+` adds objects by merging them.
- kolev 12y agoThanks! I'm eager to try this and hopefully clean up my code!
- slapresta 12y agoIf you can code it using jq itself, you can submit a pull request and have it added to the builtins.
- cryptonector 12y agoYeah, I'm a schmuck, I forgot to add release notes :( I've been thinking I need to do a 1.4.1 release just for that! (Plus we're getting some cool new features suddenly. @wtlangford (on github) is working on regexps, for example. Maybe a 1.4.1 so soon would be justified.)
- kolev 12y agoNo, you're anything, but a schmuck! Thanks for the great project!