Note:
Alfred 4 uses the same json format as Alfred 3 so not much needed to be done. You might want to change the name of is_alfred_v3() function to something else now though. Maybe something like takes_json_output or is_alfved_v3_or_v4 But that is a bigger change that wasn't totally necessary here.
This is a quick fix for Alfred 4.
Note: Alfred 4 uses the same json format as Alfred 3 so not much needed to be done. You might want to change the name of
is_alfred_v3()
function to something else now though. Maybe something liketakes_json_output
oris_alfved_v3_or_v4
But that is a bigger change that wasn't totally necessary here.