code: def _field_to_json(field, row_value):
      
      if row_value is None:
          return None
  
      if field.mode == "REPEATED":
          return _repeated_field_to_json(field, row_value)
  
      if field.field_type == "RECORD":
          return _record_field_to_json(field.fields, row_value)
  
      return _scalar_field_to_json(field, row_value)
docs: Convert a field into JSON-serializable values.
  
      Args:
          field ( \
              :class:`~google.cloud.bigquery.schema.SchemaField`, \
          ):
              The SchemaField to use for type conversion and field name.
  
          row_value (Union[ \
              Sequence[list], \
              any, \
          ]):
              Row data to be inserted. If the SchemaField's mode is
              REPEATED, assume this is a list. If not, the type
              is inferred from the SchemaField's field_type.
  
      Returns:
          any:
              A JSON-serializable object.