Jump to content

HRVSTR

Member
  • Posts

    2
  • Joined

  • Last visited

HRVSTR's Achievements

Helping Hand

Helping Hand (3/5)

0

Reputation

  1. Hi, I am creating a workflow and I want to create a script filter with strings from a bash array. Given I have an array called $regions that contains 3 strings. I want to create 3 list items from that using jq. echo $regions france netherlands denmark I tried this command but the output is obviously not compliant with Alfreds JSON format. jq -n --arg inarr "${regions}" '{ items: [ $inarr | split("\n") ] }' { "items": [ [ "france", "netherlands", "denmark" ] ] } I need the JSON to look like that: {"items": [ { "uid": "france", "title": "france", "arg": "france", "autocomplete": "france", "icon": { "path": "icons/france.png" } }, { "uid": "netherlands", "title": "netherlands", "arg": "netherlands", "autocomplete": "netherlands", "icon": { "path": "icons/netherlands.png" } }, { "uid": "denmark", "title": "denmark", "arg": "denmark", "autocomplete": "denmark", "icon": { "path": "icons/denmark.png" } }, ]} Any help would be much appreciated.
  2. Can someone link the thread because I think it is not at the top anymore. I am in the same situation and want to run subsequent list filters to run some commands via scripts.
×
×
  • Create New...