HN2
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
kolev
on June 16, 2014
|
parent
|
context
|
favorite
| on:
Jq: A lightweight and flexible command-line JSON p...
Sorry 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
on June 16, 2014
|
next
[–]
jq 'reduce .[] as $obj ({}; .+$obj)'
or
jq -s 'reduce .[] as $obj ({}; .+$obj)'
should do it. `+` adds objects by merging them.
kolev
on June 19, 2014
|
parent
|
next
[–]
Thanks! I'm eager to try this and hopefully clean up my code!
slapresta
on June 16, 2014
|
prev
[–]
If you can code it using jq itself, you can submit a pull request and have it added to the builtins.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: