Merge two objects together (shallow merge).
Code
Generalecho "$obj1" | jq --argjson o2 "$obj2" '. * $o2'Parameters
First JSON object
Second JSON object (overwrites first)
Server
More Bash Snippets
Deep Clone Object
Create a deep copy of an object (handles nested objects and arrays).
Get Nested Value
Safely get a nested property value from an object.
Is Empty Object
Check if an object has no properties.
Array Difference
Find elements in the first array that are not present in the second array.
Array Frequencies
Count how many times each value appears in an array and return a frequency map.
Array Head
Get the first n elements of an array.