code: def dump_as_json(record, output_file):
      
      def default_func(value):
          """
          Default conversion for JSON value.
          """
          if isinstance(value, frozenset):
              return sorted(value)
          raise TypeError(repr(value) + " is not JSON serializable")
  
      converted_record = record._replace(
          ordered_statistics=[x._asdict() for x in record.ordered_statistics])
      json.dump(
          converted_record._asdict(), output_file,
          default=default_func, ensure_ascii=False)
      output_file.write(os.linesep)
docs: Dump an relation record as a json value.
  
      Arguments:
          record -- A RelationRecord instance to dump.
          output_file -- A file to output.