Can’t say anything about the outcome of the OP.
However I think that “writes a json file” was not correct. IMHO such a script would or should have written to the console, hence the var result
should have got the output ( the OP did populate result
and tried to use result1
???).
I have a working example using a PHP script, look Here.