The Map method toJson returns the document as a json
Map toJson() { return {'query': document, 'variables': variables, 'headers': headers}; }