fixes #3587 - print an error on invalid json vs 500 error