def _scalar_field_to_json(field, row_value):
    """Maps a field and value to a JSON-safe value.

    Args:
        field ( \
            :class:`~google.cloud.bigquery.schema.SchemaField`, \
        ):
            The SchemaField to use for type conversion and field name.
        row_value (any):
            Value to be converted, based on the field's type.

    Returns:
        any:
            A JSON-serializable object.
    """
    converter = _SCALAR_VALUE_TO_JSON_ROW.get(field.field_type)
    if converter is None:  # STRING doesn't need converting
        return row_value
    return converter(row_value)