Jump to content

Request: request JSON action


Recommended Posts

We need a new action which calls a remote url who returns a JSON with the expected Alfred format:

 

{
  "items": [
    {
      "icon": {
        "path": "default.png"
      },
      "arg": "some_arg",
      "title": "Item Title",
      "subtitle": "Random Text"
    }
  ]
}

 

I find myself writing scripts to fetch remote json files all the time.

 

PS 1: I can dream something more complex, like an internal parser to map json properties with title, subtitle, icon, etc, but for now just read the remote file is enough.

PS 2: I know it's possible to use curl and return the json, but an action would be great 🙌

 

 

Edited by skydiver
Link to comment
Share on other sites

I think what you describe is the main reason for scripting workflows. I am uncertain if there is an easier solution to get JSON data mapped into Alfred Script Filter output? 

What  scripting language are you using? 

@deanishe provides a python helper lib: https://www.deanishe.net/alfred-workflow/

Alfred workflows typically take user input, fetch data from the Web or elsewhere, filter them and display results to the user

 

I don't know if  the helper lib is compatible with Alfred 5 for now. 

Edited by Acidham
Link to comment
Share on other sites

4 hours ago, Acidham said:

I don't know if the helper lib is compatible with Alfred 5 for now. 


Alfred 5 doesn’t change anything that would break it. The issue with that library is that it’s for Python 2 and points specifically to /usr/bin/python.

 

There are at least two Python 3 forks of it people are starting to use. One of them is by @xilopaint, but I think it’s not officially out.

Link to comment
Share on other sites

On 7/27/2022 at 7:41 AM, vitor said:

There are at least two Python 3 forks of it people are starting to use. One of them is by @xilopaint, but I think it’s not officially out.

 

I'm really close to the initial release. I think it's a matter of a couple of weeks. Just need to find some free time for finishing the test suite.

Link to comment
Share on other sites

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
 Share

×
×
  • Create New...