a.lumley Posted July 2, 2016 Share Posted July 2, 2016 Good morning, I'm currently trying to create a simple Script Filter Alfred 3 Workflow using Python. I found an earlier example which demonstrated how to pass XML results to a Python workflow: xmloutput = """ <?xml version="1.0" encoding="utf-8" ?> <items> <item arg="testitem"> <title>FooBar</title> <subtitle>foo bar is a test item</subtitle> <icon>icon.png</icon> </item> </items> """ print(xmloutput) My question is, what is the syntax for doing the same with the new JSON data structure? regards, Andrew Link to comment
vitor Posted July 3, 2016 Share Posted July 3, 2016 See the documentation for Script Filter JSON Format. Link to comment
a.lumley Posted July 3, 2016 Author Share Posted July 3, 2016 I started my research on that post but I was struggling with the implementation. For XML, it seems as though you just Print() the XML object and Alfred parses it but I can't get the same to work with JSON. Is it the same approach? Link to comment
deanishe Posted July 8, 2016 Share Posted July 8, 2016 Yes. Just print the XML/JSON string to STDOUT. It's important that you print nothing else to STDOUT, or it will make your XML/JSON invalid. 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