def to_json(self):
    """Inherit doc."""
    json = {"name": self.__class__.__name__,
            "num_ranges": len(self._iters)}

    for i in xrange(len(self._iters)):
      json_item = self._iters[i].to_json()
      query_spec = json_item["query_spec"]
      item_name = json_item["name"]
      # Delete and move one level up
      del json_item["query_spec"]
      del json_item["name"]
      json[str(i)] = json_item
    # Store once to save space
    json["query_spec"] = query_spec
    json["item_name"] = item_name

    return json
Inherit doc.