code: def to_json(self):
      
      cursor = self._get_cursor()
      cursor_object = False
      if cursor and isinstance(cursor, datastore_query.Cursor):
        cursor = cursor.to_websafe_string()
        cursor_object = True
      return {"key_range": self._key_range.to_json(),
              "query_spec": self._query_spec.to_json(),
              "cursor": cursor,
              "cursor_object": cursor_object}
docs: Serializes all states into json form.
  
      Returns:
        all states in json-compatible map.