Jump to content

Questions around using jq (json-parser)


Recommended Posts

Posted

Hi, i am building a workflow to start and stop development websites via Local.app, and i am running into a few problems: 

 

1. jq: command not found

When running the workflow, i get the message "jq: command not found", even after adding "source "${HOME}/.zshrc" to my workflow. 

 

2. Wrapping jq output in items: {} 

I don't seem to be able to wrap the jq output in the required parent node "items". (Hope it's ok to ask this question here).

 

i am using within the Script Filter: 

cat "local-site.json" | jq -j  '.[] | {uid: .id, title: .name, subtitle:.path}'

which gives me: 

  {
    "uid": "0pbbVr2HP",
    "title": "dev-site-1",
    "subtitle": "/path"
  }{
    "uid": "RK_9dUG-J",
    "title": "dev-site-2",
    "subtitle": "/path-2"
  }

 

what Alfred expects: 

{"items": [
  {
    "uid": "0pbbVr2HP",
    "title": "dev-site-1",
    "subtitle": "/path"
  }{
    "uid": "RK_9dUG-J",
    "title": "dev-site-2",
    "subtitle": "/path-2"
  }
]}


Thanks in advance! 

 

 

Posted

When asking for help with a Workflow, please upload it somewhere as we can’t properly help you without access to it. Debugging can already be hard when looking at the thing, and right now we just have a description. We’re shooting in the dark.


See the Reporting Problems with Workflows topic for an overview on building effective reports.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...