Jump to content

How to fix JSON data error for input script filter


PiKatso

Recommended Posts

This is my error : 

[ERROR: input.scriptfilter] JSON error: JSON text did not start with array or object and option to allow fragments not set. in JSON:

input the

{"items":[]}

 

"input the" is the result of code "echo $userInput

 

This Alfred node, runs a script called search.rb. I've screen shotted it below as well. The script calls all redbooth API's(a project management app) Projects, Tasklists and tasks. It then runs a loop through each item and looks for titles that match the user input/ARGV. I have run the script locally in my terminal and the script returns the correct objects and should be printing them/returning to Alfred. However I get the above issue and I can't seem to figure out where my disconnect is.

 

Additional info/screen shots below.

 

59cae5f6cd227_ScreenShot2017-09-26at3_30_59PM.png.0a344adad25d26fb35ba7e605210f4ba.png

 

search.rb/the script alfred runs to generate the script filter options.

59cae5f76d0f1_ScreenShot2017-09-26at3_33_12PM.png.b438143a4ead1b9619d6b9697bb5ca04.png

 

This code(below/list_proj.rb) calls the redbooth API and takes all returned objects/projects and converts the data to json. When the script rubs as is in a alfred script node- it populates the filter options.

This code works to the desired effect. Posting for comparison

59cae5f84334d_ScreenShot2017-09-26at3_33_38PM.png.1848ea27c76da1466609beb9270925f4.png

 

This is a snap shot of the work flow. Everything works with the exception of the Search function/nodes

59cae5f634e26_ScreenShot2017-09-26at3_30_26PM.thumb.png.485eac9e818277db9f6c7ea0ad5f40a8.png

 

Please let me know if I can provide anything else. I have a separate plugin that provides user auth for the work flow to access the redbooth client API. Any insights to this error or what I may have missed would be well appreciated. Thanks!

 

Link to comment

The output of you script should only be a JSON string, but you have "echo input $userInput" that send "input $userInput" (-> "input the") to stdout and just before the JSON string (which I assume output a correct JSON string). So, you should remove or comment this first line so it is not sent to Alfred.

Link to comment
  • 2 weeks later...

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