As per the documentation
Script Output Format
Regardless of whether it is an embedded or external script, the output needs to be a JSON object with an array of one or more events, like this:
{ "events" : [ { "happenedOn":"Fri Jun 05 09:17:47 UTC 2015", "severity":"Warn", "message":"This is the first event's message", "Source":"This is the source of the first event" }, { "happenedOn":"Fri Jun 07 09:27:37 UTC 2015", "severity":"critical", "message":"This is the second event's message", "Source":"This is the source of the second event" } ]}