updated pretty_print to work when an error has JSON output