I am trying to merge two different JSON strings from STDIN (using pipe, not files) using jq command. Here's the command trying:
curl ipinfo.io api.ipify.org/?format=json 2>/dev/null | jq -s
Output:
[
{
"ip": "139.162.244.103",
"hostname": "businessproservices.com",
"city": "London",
"region": "England",
"country": "GB",
"loc": "51.5142,-0.0931",
"postal": "EC2V",
"org": "AS63949 Linode, LLC"
},
{
"ip": "139.162.244.103"
}
]
Expected output:
{
"ip": "139.162.244.103",
"hostname": "businessproservices.com",
"city": "London",
"region": "England",
"country": "GB",
"loc": "51.5142,-0.0931",
"postal": "EC2V",
"org": "AS63949 Linode, LLC"
}
curl ipinfo.io | jq
will return expected output.