array_merge_recursive Filter

Merges the given array recursively with the original array. If a string key in the given items matches a string key in the original array, then the values for these keys are merged together into an array, and this is done recursively

{{ {'key1':'value1'}|array_merge_recursive({'key1':'value2'})|json_encode }}

{# {"key1":["value1","value2"]} #}