code: def do_json_count_values(self, params):
          try:
              Keys.validate(params.keys)
          except Keys.Bad as ex:
              self.show_output(str(ex))
              return
          path_map = PathMap(self._zk, params.path)
          values = defaultdict(int)
          for path, data in path_map.get():
              try:
                  value = Keys.value(json_deserialize(data), params.keys)
                  values[value] += 1
              except BadJSON as ex:
                  if params.report_errors:
                      self.show_output("Path %s has bad JSON.", path)
              except Keys.Missing as ex:
                  if params.report_errors:
                      self.show_output("Path %s is missing key %s.", path, ex)
          results = sorted(values.items(), key=lambda item: item[1], reverse=params.reverse)
          results = [r for r in results if r[1] >= params.minfreq]
          if params.top == 0:
              start, end = 0, len(results)
          elif params.top > 0:
              start, end = 0, params.top if params.top < len(results) else len(results)
          else:
              start = len(results) + params.top if abs(params.top) < len(results) else 0
              end = len(results)
          if len(results) > 0 and params.print_path:
              self.show_output(params.path)
          for i in range(start, end):
              value, frequency = results[i]
              self.show_output("%s = %d", value, frequency)
          if len(results) == 0:
              return False