I have two json array, which i have initialised as given below.
local=[{"account_id":"01C","id":"0XVWKCFV6P9CA5"},{"account_id":"CSDTHQ","id":"631QGYBNSF"},...............]
org=[{"account_id":"BJPKWSH","id":"15BS0XP4F91V6YH4G0PV"},{"account_id":"01BKK44V5F6A1FKH60Q0ANX9JX","id":"01BKK44V7"},.....................]
what i want is something like below.
outputJson=[{"account_id":"BJPKWSH","id":"15BS0XP4F91V6YH4G0PV"},
{"account_id":"BJPKWSH","id":"15BS0XP4F91V6YH4G0PV"},
{"account_id":"01BKK44V5F6A1FKH60Q0ANX9JX","id":"01BKK44V7"},.....................]
i.e. i want to merge these two json arrays into one. I tried this,
jq -s '.[0] * .[1]' <<< "$local $org"
but it is giving parse error: Invalid literal at line 1, column 17
< <(sqlite first query ; sqlite second query)sed "s/\"/'/g" <<< "$local" > localsed "s/\"/'/g" <<< "$org" > orglocal=[{"account_id":...all those double quotes are gone. You need to enclose json value in single quotes wile assigning them to variables, e.glocal='[{"account_id":...'