def serialize(service_mode: ServiceMode, value: dict) -> dict:
    """
    Serialize all values in a dictionary to JSON strings to ensure compatibility
    with Azure Table Storage. The Azure Table Storage API does not support
    complex data types like dictionaries or nested objects directly as values in
    entity properties; they need to be serialized to JSON strings.
    """
    item = {}
    num_properties = len(value)
    size_properties = 0
    for key, val in value.items():
        # Serialize all values for the sake of size calculation
        serialized_val, bytes_val, val_length = serialize_and_encode(val)

        size_properties += val_length
        validate_table_total_property_size(service_mode, size_properties)

        # Skips serialization for non-enums and non-serializable types
        if not isinstance(val, Enum) and isinstance(val, NON_SERIALIZABLE_TYPES):
            item[key] = val
            continue

        # Unlike Azure Table Storage, Cosmos DB does not have per-property limits
        if service_mode != ServiceMode.STORAGE:
            continue

        # No need to split the property into parts
        if val_length < STORAGE_MAX_ITEM_PROPERTY_VALUE_SIZE:
            item[key] = serialized_val
            continue

        num_parts = compute_table_property_part_count(val_length)
        num_properties += num_parts

        validate_table_property_count(num_properties)

        parts = split_large_property_value(num_parts, bytes_val, key)
        item.update(parts)

    return item

    Serialize all values in a dictionary to JSON strings to ensure compatibility
    with Azure Table Storage. The Azure Table Storage API does not support
    complex data types like dictionaries or nested objects directly as values in
    entity properties; they need to be serialized to JSON strings.
    
llama-index-utils/llama-index-utils-azure/llama_index/utils/azure/table.py