heepie Posted February 14, 2020 Share Posted February 14, 2020 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 @dataclass 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(): Parser.parseForJson(bookMarkPath) json.dump(dict(items=mapToAlfredJson()), sys.stdout, indent=2, sort_keys=True, cls=EnhancedJSONEncoder) return 0 def mapToAlfredJson(): alfredJsonList = [] for item in bookMarkList: alfredJsonList.append(dict( title=item.name, subtitle=item.url, arg=item.url, uid=item.url, valid=True, )) return alfredJsonList if __name__ == "__main__": code = main() sys.exit(code) Can I get your help? 😭 Link to comment
deanishe Posted February 14, 2020 Share Posted February 14, 2020 What does Alfred's debugger say? Also, I'm moving this post to the "Workflow Help & Questions" forum where it belongs. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now