Jump to content

[Help] Pass the result to Alfred by Script Filter

Recommended Posts

Hello, I’m developing bookmark workflow for the minor browser.

Now, I faced the problem.
I’m pass Alfred Json by script filter.
When I run my code by `python3`, I checked correct outputs like below:
  "items": [
      "arg": "https://www.alfredapp.com/help/workflows/inputs/script-filter/json/",
      "subtitle": "https://www.alfredapp.com/help/workflows/inputs/script-filter/json/",
      "title": "Script Filter JSON Format - Workflow Input Objects - Alfred Help and Support",
      "uid": "https://www.alfredapp.com/help/workflows/inputs/script-filter/json/",
      "valid": true


But I couldn’t show my result by Alfred. 
My code
class UrlItem:
    name: str
    url: str

class EnhancedJSONEncoder(json.JSONEncoder):
    def default(self, o):
        if dataclasses.is_dataclass(o):
            return dataclasses.asdict(o)
        return super().default(o)

# There is Parser class 
def main():
   json.dump(dict(items=mapToAlfredJson()), sys.stdout, indent=2, sort_keys=True, cls=EnhancedJSONEncoder)
   return 0

def mapToAlfredJson():
    alfredJsonList = []
    for item in bookMarkList:
    return alfredJsonList

if __name__ == "__main__":
    code = main()

Can I get your help? 😭

Link to comment

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...