Converts the error response back to a JSON-compatible map.
Map<String, dynamic> toJson() => { 'status': status, 'statusCode': statusCode, 'message': message, 'error': error, 'data': data, };