Quantcast
Channel: Active questions tagged jq - Stack Overflow
Viewing all articles
Browse latest Browse all 527

How to append a new object in an array containing a key in json file with jq or sed or AWK

$
0
0

file.json is as below and i have to add a new tenant entry called "test3" in "tenants" key.

{ "lease_id": "", "renewable": false, "lease_duration": 43, "data": { "collections": [ "testlines" ], "tenants": [ "test1", "test2" ] }, "wrap_info": null, "warnings": null, "auth": null }

Tried sed and awk but couldn't get desired result as below for tenants array:

"tenants": ["test1","test2","test3"]},


Viewing all articles
Browse latest Browse all 527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>