toJson

Returns the error message as a JSON object to be sent to the server.