I have JSON
[ {"id": "1"}, {"id": "5"}, {"id": "9"}, {"id": "0"}, {"id": "3"} ] I want to insert an object to produce:
[ {"id": "1"}, {"id": "5"}, {"id": "2"}, {"id": "9"}, {"id": "0"}, {"id": "3"} ] How do I do this jq? Either by index or relative to other objects.
EDIT: This is not a duplicate of Add new element to existing JSON array with jq , which is about appending/prepending elements to arrays. As stated, I want to insert an element.
https://stackoverflow.com/questions/66428658/how-to-insert-element-into-array-with-jq March 02, 2021 at 03:46AM
没有评论:
发表评论