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