Skip to content

how to insert an object at a certain place #277

Answered by larsga
movalz asked this question in Q&A
Discussion options

You must be logged in to vote

The trick is to search for the index of that item, then use that in the expression above to cut the array at the right point.

This should work:

[for (zip-with-index(.items))
  .index if (.value.name == "item2")][0]

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@movalz
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by movalz
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
support Users asking how to solve a specific issue
2 participants