Output json to stdout

Also replace print to print on stderr