GitLab allows one to attach labels to issues. I would like to use jq to dig into the JSON representation of these labels. Here’s the labels section of the JSON file for one issue:
"labels": [
"AI::Assessed",
"Pri::1 - High",
"Type::Investigation",
"v::Backlog"
]
How, with jq, can I get at the value of the "v" label, which here is "Backlog"?
Note that the number of labels varies from issue to issue. The ::
signifies that a label is a scoped label.
2
Answers
You can use
capture
:A trivial solution with
startswith
and substring/string-slicing: