add ErrorMessage#as_json

We're using this internally in our testing and tools, I figured it might be generally useful