public class Product: Codable, ObjectDebugger { // public var images: Images? = Images() public var ingredients: [Ingredient]? = [] public var languagesCodes: LanguagesCodes? public var nutrientLevels: NutrientLevels? public var nutriments: Nutriments? = Nutriments() public var selectedImages: SelectedImages? public var sources: [Source]? = [] public var additivesN: Float? public var additivesOldN: Float? public var additivesOriginalTags: [String]? public var additivesOldTags: [String]? public var additivesPrevOriginalTags: [String]? public var additivesDebugTags: [String]? public var additivesTags: [String]? public var allergens: String? public var allergensFromIngredients: String? public var allergensFromUser: String? public var allergensHierarchy: [String]? public var allergensLc: String? public var allergensTags: [String]? public var aminoAcidsPrevTags: [String]? public var aminoAcidsTags: [String]? public var brands: String? public var brandsDebugTags: [String]? public var brandsTags: [String]? public var carbonFootprintPercentOfKnownIngredients: Float? public var carbonFootprintFromKnownIngredientsDebug: String? public var categories: String? public var categoriesHierarchy: [String]? public var categoriesLc: String? public var categoriesPropertiesTags: [String]? public var categoriesTags: [String]? public var checkersTags: [String]? public var citiesTags: [String]? public var code: String? public var codesTags: [String]? public var comparedToCategory: String? public var complete: Float? public var completedT: Float? public var completeness: Double? public var conservationConditions: String? public var countries: String? public var countriesHierarchy: [String]? public var countriesLc: String? public var countriesDebugTags: [String]? public var countriesTags: [String]? public var correctorsTags: [String]? public var createdT: Float? public var creator: String? public var dataQualityBugsTags: [String]? public var dataQualityErrorsTags: [String]? public var dataQualityInfoTags: [String]? public var dataQualityTags: [String]? public var dataQualityWarningsTags: [String]? public var dataSources: String? public var dataSourcesTags: [String]? public var debugParamSortedLangs: [String]? public var editorsTags: [String]? public var embCodes: String? public var embCodesDebugTags: [String]? public var embCodesOrig: String? public var embCodesTags: [String]? public var entryDatesTags: [String]? public var expirationDate: String? public var expirationDateDebugTags: [String]? public var fruitsVegetablesNuts100GEstimate: Float? public var genericName: String? public var id: String? public var imageFrontSmallUrl: String? public var imageFrontThumbUrl: String? public var imageFrontUrl: String? public var imageIngredientsUrl: String? public var imageIngredientsSmallUrl: String? public var imageIngredientsThumbUrl: String? public var imageNutritionSmallUrl: String? public var imageNutritionThumbUrl: String? public var imageNutritionUrl: String? public var imageSmallUrl: String? public var imageThumbUrl: String? public var imageUrl: String? public var informersTags: [String]? public var ingredientsAnalysisTags: [String]? public var ingredientsDebug: [String?]? public var ingredientsFromOrThatMayBeFromPalmOilN: Float? public var ingredientsFromPalmOilTags: [String]? public var ingredientsFromPalmOilN: Float? public var ingredientsHierarchy: [String]? public var ingredientsIdsDebug: [String]? public var ingredientsN: Float? public var ingredientsNTags: [String]? public var ingredientsOriginalTags: [String]? public var ingredientsTags: [String]? public var ingredientsText: String? public var ingredientsTextDebug: String? public var ingredientsTextWithAllergens: String? public var ingredientsThatMayBeFromPalmOilN: Float? public var ingredientsThatMayBeFromPalmOilTags: [String]? public var interfaceVersionCreated: String? public var interfaceVersionModified: String? public var keywords: [String]? public var knownIngredientsN: Float? public var labels: String? public var labelsHierarchy: [String]? public var labelsLc: String? public var labelsPrevHierarchy: [String]? public var labelsPrevTags: [String]? public var labelsTags: [String]? public var labelsDebugTags: [String]? public var lang: String? public var langDebugTags: [String]? public var languagesHierarchy: [String]? public var languagesTags: [String]? public var lastEditDatesTags: [String]? public var lastEditor: String? public var lastImageDatesTags: [String]? public var lastImageT: Float? public var lastModifiedBy: String? public var lastModifiedT: Float? public var lc: String? public var link: String? public var linkDebugTags: [String]? public var manufacturingPlaces: String? public var manufacturingPlacesDebugTags: [String]? public var manufacturingPlacesTags: [String]? public var maxImgid: String? public var mineralsPrevTags: [String]? public var mineralsTags: [String]? public var miscTags: [String]? public var netWeightUnit: String? public var netWeightValue: String? public var nutritionDataPer: String? public var nutritionScoreWarningNoFruitsVegetablesNuts: Float? public var nutriscoreGrade: String? public var noNutritionData: String? public var novaGroup: Float? public var novaGroups: String? public var novaGroupDebug: String? public var novaGroupTags: [String]? public var novaGroupsTags: [String]? public var nucleotidesPrevTags: [String]? public var nucleotidesTags: [String]? public var nutrientLevelsTags: [String]? public var nutritionData: String? public var nutritionDataPerDebugTags: [String]? public var nutritionDataPrepared: String? public var nutritionDataPreparedPer: String? public var nutritionGrades: String? public var nutritionScoreBeverage: Float? public var nutritionScoreDebug: String? public var nutritionScoreWarningNoFiber: Float? public var nutritionGradesTags: [String]? public var origins: String? public var originsDebugTags: [String]? public var originsTags: [String]? public var otherInformation: String? public var otherNutritionalSubstancesTags: [String]? public var packaging: String? public var packagingDebugTags: [String]? public var packagingTags: [String]? public var photographersTags: [String]? public var pnnsGroups1: String? public var pnnsGroups2: String? public var pnnsGroups1Tags: [String]? public var pnnsGroups2Tags: [String]? public var popularityKey: Float? public var producerVersionId: String? public var productName: String? public var productQuantity: Float? public var productQuantityUnit: String? public var purchasePlaces: String? public var purchasePlacesDebugTags: [String]? public var purchasePlacesTags: [String]? public var qualityTags: [String]? public var quantity: String? public var quantityDebugTags: [String]? public var recyclingInstructionsToDiscard: String? public var rev: Float? public var servingQuantity: String? public var servingQuantityUnit: String? public var servingSize: String? public var servingSizeDebugTags: [String]? public var sortkey: Float? public var states: String? public var statesHierarchy: [String]? public var statesTags: [String]? public var stores: String? public var storesDebugTags: [String]? public var storesTags: [String]? public var traces: String? public var tracesFromIngredients: String? public var tracesHierarchy: [String]? public var tracesDebugTags: [String]? public var tracesFromUser: String? public var tracesLc: String? public var tracesTags: [String]? public var unknownIngredientsN: Float? public var unknownNutrientsTags: [String]? public var updateKey: String? public var vitaminsPrevTags: [String]? public var vitaminsTags: [String]? private enum CodingKeys: String, CodingKey { // case images case ingredients case languagesCodes = "languages_codes" case nutrientLevels = "nutrient_levels" case nutriments case selectedImages = "selected_images" case sources case additivesN = "additives_n" case additivesOldN = "additives_old_n" case additivesOriginalTags = "additives_original_tags" case additivesOldTags = "additives_old_tags" case additivesPrevOriginalTags = "additives_prev_original_tags" case additivesDebugTags = "additives_debug_tags" case additivesTags = "additives_tags" case allergens case allergensFromIngredients = "allergens_from_ingredients" case allergensFromUser = "allergens_from_user" case allergensHierarchy = "allergens_hierarchy" case allergensLc = "allergens_lc" case allergensTags = "allergens_tags" case aminoAcidsPrevTags = "amino_acids_prev_tags" case aminoAcidsTags = "amino_acids_tags" case brands case brandsDebugTags = "brands_debug_tags" case brandsTags = "brands_tags" case carbonFootprintPercentOfKnownIngredients = "carbon_footprint_percent_of_known_ingredients" case carbonFootprintFromKnownIngredientsDebug = "carbon_footprint_from_known_ingredients_debug" case categories case categoriesHierarchy = "categories_hierarchy" case categoriesLc = "categories_lc" case categoriesPropertiesTags = "categories_properties_tags" case categoriesTags = "categories_tags" case checkersTags = "checkers_tags" case citiesTags = "cities_tags" case code case codesTags = "codes_tags" case comparedToCategory = "compared_to_category" case complete case completedT = "completed_t" case completeness case conservationConditions = "conservation_conditions" case countries case countriesHierarchy = "countries_hierarchy" case countriesLc = "countries_lc" case countriesDebugTags = "countries_debug_tags" case countriesTags = "countries_tags" case correctorsTags = "correctors_tags" case createdT = "created_t" case creator case dataQualityBugsTags = "data_quality_bugs_tags" case dataQualityErrorsTags = "data_quality_errors_tags" case dataQualityInfoTags = "data_quality_info_tags" case dataQualityTags = "data_quality_tags" case dataQualityWarningsTags = "data_quality_warnings_tags" case dataSources = "data_sources" case dataSourcesTags = "data_sources_tags" case debugParamSortedLangs = "debug_param_sorted_langs" case editorsTags = "editors_tags" case embCodes = "emb_codes" case embCodesDebugTags = "emb_codes_debug_tags" case embCodesOrig = "emb_codes_orig" case embCodesTags = "emb_codes_tags" case entryDatesTags = "entry_dates_tags" case expirationDate = "expiration_date" case expirationDateDebugTags = "expiration_date_debug_tags" case fruitsVegetablesNuts100GEstimate = "fruits-vegetables-nuts_100g_estimate" case genericName case id case imageFrontSmallUrl = "image_front_small_url" case imageFrontThumbUrl = "image_front_thumb_url" case imageFrontUrl = "image_front_url" case imageIngredientsUrl = "image_ingredients_url" case imageIngredientsSmallUrl = "image_ingredients_small_url" case imageIngredientsThumbUrl = "image_ingredients_thumb_url" case imageNutritionSmallUrl = "image_nutrition_small_url" case imageNutritionThumbUrl = "image_nutrition_thumb_url" case imageNutritionUrl = "image_nutrition_url" case imageSmallUrl = "image_small_url" case imageThumbUrl = "image_thumb_url" case imageUrl = "image_url" case informersTags = "informers_tags" case ingredientsAnalysisTags = "ingredients_analysis_tags" case ingredientsDebug = "ingredients_debug" case ingredientsFromOrThatMayBeFromPalmOilN = "ingredients_from_or_that_may_be_from_palm_oil_n" case ingredientsFromPalmOilTags = "ingredients_from_palm_oil_tags" case ingredientsFromPalmOilN = "ingredients_from_palm_oil_n" case ingredientsHierarchy = "ingredients_hierarchy" case ingredientsIdsDebug = "ingredients_ids_debug" case ingredientsN = "ingredients_n" case ingredientsNTags = "ingredients_n_tags" case ingredientsOriginalTags = "ingredients_original_tags" case ingredientsTags = "ingredients_tags" case ingredientsText = "ingredients_text" case ingredientsTextDebug = "ingredients_text_debug" case ingredientsTextWithAllergens = "ingredients_text_with_allergens" case ingredientsThatMayBeFromPalmOilN = "ingredients_that_may_be_from_palm_oil_n" case ingredientsThatMayBeFromPalmOilTags = "ingredients_that_may_be_from_palm_oil_tags" case interfaceVersionCreated = "interface_version_created" case interfaceVersionModified = "interface_version_modified" case keywords case knownIngredientsN = "known_ingredients_n" case labels case labelsHierarchy = "labels_hierarchy" case labelsLc = "labels_lc" case labelsPrevHierarchy = "labels_prev_hierarchy" case labelsPrevTags = "labels_prev_tags" case labelsTags = "labels_tags" case labelsDebugTags = "labels_debug_tags" case lang case langDebugTags = "lang_debug_tags" case languagesHierarchy = "languages_hierarchy" case languagesTags = "languages_tags" case lastEditDatesTags = "last_edit_dates_tags" case lastEditor = "last_editor" case lastImageDatesTags = "last_image_dates_tags" case lastImageT = "last_image_t" case lastModifiedBy = "last_modified_by" case lastModifiedT = "last_modified_t" case lc case link case linkDebugTags = "link_debug_tags" case manufacturingPlaces = "manufacturing_places" case manufacturingPlacesDebugTags = "manufacturing_places_debug_tags" case manufacturingPlacesTags = "manufacturing_places_tags" case maxImgid = "max_imgid" case mineralsPrevTags = "minerals_prev_tags" case mineralsTags = "minerals_tags" case miscTags = "misc_tags" case netWeightUnit = "net_weight_unit" case netWeightValue = "net_weight_value" case nutritionDataPer = "nutrition_data_per" case nutritionScoreWarningNoFruitsVegetablesNuts = "nutrition_score_warning_no_fruits_vegetables_nuts" case nutriscoreGrade = "nutriscore_grade" case noNutritionData = "no_nutrition_data" case novaGroup = "nova_group" case novaGroups = "nova_groups" case novaGroupDebug = "nova_group_debug" case novaGroupTags = "nova_group_tags" case novaGroupsTags = "nova_groups_tags" case nucleotidesPrevTags = "nucleotides_prev_tags" case nucleotidesTags = "nucleotides_tags" case nutrientLevelsTags = "nutrient_levels_tags" case nutritionData = "nutrition_data" case nutritionDataPerDebugTags = "nutrition_data_per_debug_tags" case nutritionDataPrepared = "nutrition_data_prepared" case nutritionDataPreparedPer = "nutrition_data_prepared_per" case nutritionGrades = "nutrition_grades" case nutritionScoreBeverage = "nutrition_score_beverage" case nutritionScoreDebug = "nutrition_score_debug" case nutritionScoreWarningNoFiber = "nutrition_score_warning_no_fiber" case nutritionGradesTags = "nutrition_grades_tags" case origins case originsDebugTags = "origins_debug_tags" case originsTags = "origins_tags" case otherInformation = "other_information" case otherNutritionalSubstancesTags = "other_nutritional_substances_tags" case packaging case packagingDebugTags = "packaging_debug_tags" case packagingTags = "packaging_tags" case photographersTags = "photographers_tags" case pnnsGroups1 = "pnns_groups_1" case pnnsGroups2 = "pnns_groups_2" case pnnsGroups1Tags = "pnns_groups_1_tags" case pnnsGroups2Tags = "pnns_groups_2_tags" case popularityKey = "popularity_key" case producerVersionId = "producer_version_id" case productName = "product_name" case productQuantity = "product_quantity" case productQuantityUnit = "product_quantity_unit" case purchasePlaces = "purchase_places" case purchasePlacesDebugTags = "purchase_places_debug_tags" case purchasePlacesTags = "purchase_places_tags" case qualityTags = "quality_tags" case quantity case quantityDebugTags = "quantity_debug_tags" case recyclingInstructionsToDiscard = "recycling_instructions_to_discard" case rev case servingQuantity = "serving_quantity" case servingQuantityUnit = "serving_quantity_unit" case servingSize = "serving_size" case servingSizeDebugTags = "serving_size_debug_tags" case sortkey case states case statesHierarchy = "states_hierarchy" case statesTags = "states_tags" case stores case storesDebugTags = "stores_debug_tags" case storesTags = "stores_tags" case traces case tracesFromIngredients = "traces_from_ingredients" case tracesHierarchy = "traces_hierarchy" case tracesDebugTags = "traces_debug_tags" case tracesFromUser = "traces_from_user" case tracesLc = "traces_lc" case tracesTags = "traces_tags" case unknownIngredientsN = "unknown_ingredients_n" case unknownNutrientsTags = "unknown_nutrients_tags" case updateKey = "update_key" case vitaminsPrevTags = "vitamins_prev_tags" case vitaminsTags = "vitamins_tags" } public required init(from decoder: Decoder) throws { let container = try decoder.container(keyedBy: CodingKeys.self) ingredients = try container.decodeIfPresent( [Ingredient].self, forKey: .ingredients) languagesCodes = try container.decodeIfPresent( LanguagesCodes.self, forKey: .languagesCodes) nutrientLevels = try container.decodeIfPresent( NutrientLevels.self, forKey: .nutrientLevels) nutriments = try container.decodeIfPresent(Nutriments.self, forKey: .nutriments) ?? Nutriments() selectedImages = try container.decodeIfPresent( SelectedImages.self, forKey: .selectedImages) sources = try container.decodeIfPresent([Source].self, forKey: .sources) additivesN = try container.decodeIfPresent( Float.self, forKey: .additivesN) additivesOldN = try container.decodeIfPresent( Float.self, forKey: .additivesOldN) additivesOriginalTags = try container.decodeIfPresent( [String].self, forKey: .additivesOriginalTags) additivesOldTags = try container.decodeIfPresent( [String].self, forKey: .additivesOldTags) additivesPrevOriginalTags = try container.decodeIfPresent( [String].self, forKey: .additivesPrevOriginalTags) additivesDebugTags = try container.decodeIfPresent( [String].self, forKey: .additivesDebugTags) additivesTags = try container.decodeIfPresent( [String].self, forKey: .additivesTags) allergens = try container.decodeIfPresent( String.self, forKey: .allergens) allergensFromIngredients = try container.decodeIfPresent( String.self, forKey: .allergensFromIngredients) allergensFromUser = try container.decodeIfPresent( String.self, forKey: .allergensFromUser) allergensHierarchy = try container.decodeIfPresent( [String].self, forKey: .allergensHierarchy) allergensLc = try container.decodeIfPresent( String.self, forKey: .allergensLc) allergensTags = try container.decodeIfPresent( [String].self, forKey: .allergensTags) aminoAcidsPrevTags = try container.decodeIfPresent( [String].self, forKey: .aminoAcidsPrevTags) aminoAcidsTags = try container.decodeIfPresent( [String].self, forKey: .aminoAcidsTags) brands = try container.decodeIfPresent(String.self, forKey: .brands) brandsDebugTags = try container.decodeIfPresent( [String].self, forKey: .brandsDebugTags) brandsTags = try container.decodeIfPresent( [String].self, forKey: .brandsTags) carbonFootprintPercentOfKnownIngredients = try container.decodeIfPresent( Float.self, forKey: .carbonFootprintPercentOfKnownIngredients) carbonFootprintFromKnownIngredientsDebug = try container.decodeIfPresent( String.self, forKey: .carbonFootprintFromKnownIngredientsDebug) categories = try container.decodeIfPresent( String.self, forKey: .categories) categoriesHierarchy = try container.decodeIfPresent( [String].self, forKey: .categoriesHierarchy) categoriesLc = try container.decodeIfPresent( String.self, forKey: .categoriesLc) categoriesPropertiesTags = try container.decodeIfPresent( [String].self, forKey: .categoriesPropertiesTags) categoriesTags = try container.decodeIfPresent( [String].self, forKey: .categoriesTags) checkersTags = try container.decodeIfPresent( [String].self, forKey: .checkersTags) citiesTags = try container.decodeIfPresent( [String].self, forKey: .citiesTags) code = try container.decodeIfPresent(String.self, forKey: .code) codesTags = try container.decodeIfPresent( [String].self, forKey: .codesTags) comparedToCategory = try container.decodeIfPresent( String.self, forKey: .comparedToCategory) complete = try container.decodeIfPresent(Float.self, forKey: .complete) completedT = try container.decodeIfPresent( Float.self, forKey: .completedT) completeness = try container.decodeIfPresent( Double.self, forKey: .completeness) conservationConditions = try container.decodeIfPresent( String.self, forKey: .conservationConditions) countries = try container.decodeIfPresent( String.self, forKey: .countries) countriesHierarchy = try container.decodeIfPresent( [String].self, forKey: .countriesHierarchy) countriesLc = try container.decodeIfPresent( String.self, forKey: .countriesLc) countriesDebugTags = try container.decodeIfPresent( [String].self, forKey: .countriesDebugTags) countriesTags = try container.decodeIfPresent( [String].self, forKey: .countriesTags) correctorsTags = try container.decodeIfPresent( [String].self, forKey: .correctorsTags) createdT = try container.decodeIfPresent(Float.self, forKey: .createdT) creator = try container.decodeIfPresent(String.self, forKey: .creator) dataQualityBugsTags = try container.decodeIfPresent( [String].self, forKey: .dataQualityBugsTags) dataQualityErrorsTags = try container.decodeIfPresent( [String].self, forKey: .dataQualityErrorsTags) dataQualityInfoTags = try container.decodeIfPresent( [String].self, forKey: .dataQualityInfoTags) dataQualityTags = try container.decodeIfPresent( [String].self, forKey: .dataQualityTags) dataQualityWarningsTags = try container.decodeIfPresent( [String].self, forKey: .dataQualityWarningsTags) dataSources = try container.decodeIfPresent( String.self, forKey: .dataSources) dataSourcesTags = try container.decodeIfPresent( [String].self, forKey: .dataSourcesTags) debugParamSortedLangs = try container.decodeIfPresent( [String].self, forKey: .debugParamSortedLangs) editorsTags = try container.decodeIfPresent( [String].self, forKey: .editorsTags) embCodes = try container.decodeIfPresent(String.self, forKey: .embCodes) embCodesDebugTags = try container.decodeIfPresent( [String].self, forKey: .embCodesDebugTags) embCodesOrig = try container.decodeIfPresent( String.self, forKey: .embCodesOrig) embCodesTags = try container.decodeIfPresent( [String].self, forKey: .embCodesTags) entryDatesTags = try container.decodeIfPresent( [String].self, forKey: .entryDatesTags) expirationDate = try container.decodeIfPresent( String.self, forKey: .expirationDate) expirationDateDebugTags = try container.decodeIfPresent( [String].self, forKey: .expirationDateDebugTags) fruitsVegetablesNuts100GEstimate = try container.decodeIfPresent( Float.self, forKey: .fruitsVegetablesNuts100GEstimate) genericName = try container.decodeIfPresent( String.self, forKey: .genericName) id = try container.decodeIfPresent(String.self, forKey: .id) imageFrontSmallUrl = try container.decodeIfPresent( String.self, forKey: .imageFrontSmallUrl) imageFrontThumbUrl = try container.decodeIfPresent( String.self, forKey: .imageFrontThumbUrl) imageFrontUrl = try container.decodeIfPresent( String.self, forKey: .imageFrontUrl) imageIngredientsUrl = try container.decodeIfPresent( String.self, forKey: .imageIngredientsUrl) imageIngredientsSmallUrl = try container.decodeIfPresent( String.self, forKey: .imageIngredientsSmallUrl) imageIngredientsThumbUrl = try container.decodeIfPresent( String.self, forKey: .imageIngredientsThumbUrl) imageNutritionSmallUrl = try container.decodeIfPresent( String.self, forKey: .imageNutritionSmallUrl) imageNutritionThumbUrl = try container.decodeIfPresent( String.self, forKey: .imageNutritionThumbUrl) imageNutritionUrl = try container.decodeIfPresent( String.self, forKey: .imageNutritionUrl) imageSmallUrl = try container.decodeIfPresent( String.self, forKey: .imageSmallUrl) imageThumbUrl = try container.decodeIfPresent( String.self, forKey: .imageThumbUrl) imageUrl = try container.decodeIfPresent(String.self, forKey: .imageUrl) informersTags = try container.decodeIfPresent( [String].self, forKey: .informersTags) ingredientsAnalysisTags = try container.decodeIfPresent( [String].self, forKey: .ingredientsAnalysisTags) ingredientsDebug = try container.decodeIfPresent( [String?].self, forKey: .ingredientsDebug) ingredientsFromOrThatMayBeFromPalmOilN = try container.decodeIfPresent( Float.self, forKey: .ingredientsFromOrThatMayBeFromPalmOilN) ingredientsFromPalmOilTags = try container.decodeIfPresent( [String].self, forKey: .ingredientsFromPalmOilTags) ingredientsFromPalmOilN = try container.decodeIfPresent( Float.self, forKey: .ingredientsFromPalmOilN) ingredientsHierarchy = try container.decodeIfPresent( [String].self, forKey: .ingredientsHierarchy) ingredientsIdsDebug = try container.decodeIfPresent( [String].self, forKey: .ingredientsIdsDebug) if container.contains(.ingredientsN) { if try container.decodeNil(forKey: .ingredientsN) { ingredientsN = nil } else { if let intValue = try? container.decode( Float.self, forKey: .ingredientsN) { ingredientsN = intValue } else if let stringValue = try? container.decode( String.self, forKey: .ingredientsN) { ingredientsN = Float(stringValue) } else { // If decoding as both Float and String fails, handle the error accordingly throw DecodingError.dataCorruptedError( forKey: .ingredientsN, in: container, debugDescription: "Unable to decode ingredientsN" ) } } } else { ingredientsN = nil } ingredientsNTags = try container.decodeIfPresent( [String].self, forKey: .ingredientsNTags) ingredientsOriginalTags = try container.decodeIfPresent( [String].self, forKey: .ingredientsOriginalTags) ingredientsTags = try container.decodeIfPresent( [String].self, forKey: .ingredientsTags) ingredientsText = try container.decodeIfPresent( String.self, forKey: .ingredientsText) ingredientsTextDebug = try container.decodeIfPresent( String.self, forKey: .ingredientsTextDebug) ingredientsTextWithAllergens = try container.decodeIfPresent( String.self, forKey: .ingredientsTextWithAllergens) ingredientsThatMayBeFromPalmOilN = try container.decodeIfPresent( Float.self, forKey: .ingredientsThatMayBeFromPalmOilN) ingredientsThatMayBeFromPalmOilTags = try container.decodeIfPresent( [String].self, forKey: .ingredientsThatMayBeFromPalmOilTags) interfaceVersionCreated = try container.decodeIfPresent( String.self, forKey: .interfaceVersionCreated) interfaceVersionModified = try container.decodeIfPresent( String.self, forKey: .interfaceVersionModified) keywords = try container.decodeIfPresent( [String].self, forKey: .keywords) knownIngredientsN = try container.decodeIfPresent( Float.self, forKey: .knownIngredientsN) labels = try container.decodeIfPresent(String.self, forKey: .labels) labelsHierarchy = try container.decodeIfPresent( [String].self, forKey: .labelsHierarchy) labelsLc = try container.decodeIfPresent(String.self, forKey: .labelsLc) labelsPrevHierarchy = try container.decodeIfPresent( [String].self, forKey: .labelsPrevHierarchy) labelsPrevTags = try container.decodeIfPresent( [String].self, forKey: .labelsPrevTags) labelsTags = try container.decodeIfPresent( [String].self, forKey: .labelsTags) labelsDebugTags = try container.decodeIfPresent( [String].self, forKey: .labelsDebugTags) lang = try container.decodeIfPresent(String.self, forKey: .lang) langDebugTags = try container.decodeIfPresent( [String].self, forKey: .langDebugTags) languagesHierarchy = try container.decodeIfPresent( [String].self, forKey: .languagesHierarchy) languagesTags = try container.decodeIfPresent( [String].self, forKey: .languagesTags) lastEditDatesTags = try container.decodeIfPresent( [String].self, forKey: .lastEditDatesTags) lastEditor = try container.decodeIfPresent( String.self, forKey: .lastEditor) lastImageDatesTags = try container.decodeIfPresent( [String].self, forKey: .lastImageDatesTags) lastImageT = try container.decodeIfPresent( Float.self, forKey: .lastImageT) lastModifiedBy = try container.decodeIfPresent( String.self, forKey: .lastModifiedBy) if container.contains(.lastModifiedT) { if try container.decodeNil(forKey: .maxImgid) { lastModifiedT = nil } else { if let floatValue = try? container.decode( Float.self, forKey: .lastModifiedT) { lastModifiedT = floatValue } else if let stringValue = try? container.decode( String.self, forKey: .lastModifiedT) { lastModifiedT = Float(stringValue) } else { // If decoding as both Float and String fails, handle the error accordingly throw DecodingError.dataCorruptedError( forKey: .lastModifiedT, in: container, debugDescription: "Unable to decode lastModifiedT" ) } } } else { lastModifiedT = nil } lc = try container.decodeIfPresent(String.self, forKey: .lc) link = try container.decodeIfPresent(String.self, forKey: .link) linkDebugTags = try container.decodeIfPresent( [String].self, forKey: .linkDebugTags) manufacturingPlaces = try container.decodeIfPresent( String.self, forKey: .manufacturingPlaces) manufacturingPlacesDebugTags = try container.decodeIfPresent( [String].self, forKey: .manufacturingPlacesDebugTags) manufacturingPlacesTags = try container.decodeIfPresent( [String].self, forKey: .manufacturingPlacesTags) if container.contains(.maxImgid) { if try container.decodeNil(forKey: .maxImgid) { maxImgid = nil } else { if let floatValue = try? container.decode( Float.self, forKey: .maxImgid) { maxImgid = "\(floatValue)" } else if let stringValue = try? container.decode( String.self, forKey: .maxImgid) { maxImgid = stringValue } else { // If decoding as both Float and String fails, handle the error accordingly throw DecodingError.dataCorruptedError( forKey: .maxImgid, in: container, debugDescription: "Unable to decode maxImgid" ) } } } else { maxImgid = nil } mineralsPrevTags = try container.decodeIfPresent( [String].self, forKey: .mineralsPrevTags) mineralsTags = try container.decodeIfPresent( [String].self, forKey: .mineralsTags) miscTags = try container.decodeIfPresent( [String].self, forKey: .miscTags) netWeightUnit = try container.decodeIfPresent( String.self, forKey: .netWeightUnit) netWeightValue = try container.decodeIfPresent( String.self, forKey: .netWeightValue) nutritionDataPer = try container.decodeIfPresent( String.self, forKey: .nutritionDataPer) nutritionScoreWarningNoFruitsVegetablesNuts = try container.decodeIfPresent( Float.self, forKey: .nutritionScoreWarningNoFruitsVegetablesNuts ) noNutritionData = try container.decodeIfPresent( String.self, forKey: .noNutritionData) novaGroup = try container.decodeIfPresent( Float.self, forKey: .novaGroup) novaGroups = try container.decodeIfPresent( String.self, forKey: .novaGroups) novaGroupDebug = try container.decodeIfPresent( String.self, forKey: .novaGroupDebug) novaGroupTags = try container.decodeIfPresent( [String].self, forKey: .novaGroupTags) novaGroupsTags = try container.decodeIfPresent( [String].self, forKey: .novaGroupsTags) nucleotidesTags = try container.decodeIfPresent( [String].self, forKey: .nucleotidesTags) nutrientLevelsTags = try container.decodeIfPresent( [String].self, forKey: .nutrientLevelsTags) nutritionData = try container.decodeIfPresent( String.self, forKey: .nutritionData) nutriscoreGrade = try container.decodeIfPresent( String.self, forKey: .nutriscoreGrade) nutritionDataPerDebugTags = try container.decodeIfPresent( [String].self, forKey: .nutritionDataPerDebugTags) nutritionDataPrepared = try container.decodeIfPresent( String.self, forKey: .nutritionDataPrepared) nutritionDataPreparedPer = try container.decodeIfPresent( String.self, forKey: .nutritionDataPreparedPer) nutritionGrades = try container.decodeIfPresent( String.self, forKey: .nutritionGrades) nutritionScoreBeverage = try container.decodeIfPresent( Float.self, forKey: .nutritionScoreBeverage) nutritionScoreDebug = try container.decodeIfPresent( String.self, forKey: .nutritionScoreDebug) nutritionScoreWarningNoFiber = try container.decodeIfPresent( Float.self, forKey: .nutritionScoreWarningNoFiber) nutritionGradesTags = try container.decodeIfPresent( [String].self, forKey: .nutritionGradesTags) origins = try container.decodeIfPresent(String.self, forKey: .origins) originsDebugTags = try container.decodeIfPresent( [String].self, forKey: .originsDebugTags) originsTags = try container.decodeIfPresent( [String].self, forKey: .originsTags) otherInformation = try container.decodeIfPresent( String.self, forKey: .otherInformation) otherNutritionalSubstancesTags = try container.decodeIfPresent( [String].self, forKey: .otherNutritionalSubstancesTags) packaging = try container.decodeIfPresent( String.self, forKey: .packaging) packagingDebugTags = try container.decodeIfPresent( [String].self, forKey: .packagingDebugTags) packagingTags = try container.decodeIfPresent( [String].self, forKey: .packagingTags) photographersTags = try container.decodeIfPresent( [String].self, forKey: .photographersTags) pnnsGroups1 = try container.decodeIfPresent( String.self, forKey: .pnnsGroups1) pnnsGroups2 = try container.decodeIfPresent( String.self, forKey: .pnnsGroups2) pnnsGroups1Tags = try container.decodeIfPresent( [String].self, forKey: .pnnsGroups1Tags) pnnsGroups2Tags = try container.decodeIfPresent( [String].self, forKey: .pnnsGroups2Tags) popularityKey = try container.decodeIfPresent( Float.self, forKey: .popularityKey) producerVersionId = try container.decodeIfPresent( String.self, forKey: .producerVersionId) productName = try container.decodeIfPresent( String.self, forKey: .productName) purchasePlaces = try container.decodeIfPresent( String.self, forKey: .purchasePlaces) purchasePlacesDebugTags = try container.decodeIfPresent( [String].self, forKey: .purchasePlacesDebugTags) purchasePlacesTags = try container.decodeIfPresent( [String].self, forKey: .purchasePlacesTags) qualityTags = try container.decodeIfPresent( [String].self, forKey: .qualityTags) quantity = try container.decodeIfPresent(String.self, forKey: .quantity) quantityDebugTags = try container.decodeIfPresent( [String].self, forKey: .quantityDebugTags) recyclingInstructionsToDiscard = try container.decodeIfPresent( String.self, forKey: .recyclingInstructionsToDiscard) rev = try container.decodeIfPresent(Float.self, forKey: .rev) if container.contains(.servingQuantity) { if try container.decodeNil(forKey: .servingQuantity) { servingQuantity = nil } else { if let floatValue = try? container.decode( Float.self, forKey: .servingQuantity) { servingQuantity = "\(floatValue)" } else if let stringValue = try? container.decode( String.self, forKey: .servingQuantity) { servingQuantity = stringValue } else { // If decoding as both Float and String fails, handle the error accordingly throw DecodingError.dataCorruptedError( forKey: .servingQuantity, in: container, debugDescription: "Unable to decode servingQuantity" ) } } } else { servingQuantity = nil } servingQuantityUnit = try container.decodeIfPresent( String.self, forKey: .servingQuantityUnit) servingSize = try container.decodeIfPresent( String.self, forKey: .servingSize) servingSizeDebugTags = try container.decodeIfPresent( [String].self, forKey: .servingSizeDebugTags) sortkey = try container.decodeIfPresent(Float.self, forKey: .sortkey) states = try container.decodeIfPresent(String.self, forKey: .states) statesHierarchy = try container.decodeIfPresent( [String].self, forKey: .statesHierarchy) statesTags = try container.decodeIfPresent( [String].self, forKey: .statesTags) stores = try container.decodeIfPresent(String.self, forKey: .stores) storesDebugTags = try container.decodeIfPresent( [String].self, forKey: .storesDebugTags) storesTags = try container.decodeIfPresent( [String].self, forKey: .storesTags) traces = try container.decodeIfPresent(String.self, forKey: .traces) tracesFromIngredients = try container.decodeIfPresent( String.self, forKey: .tracesFromIngredients) tracesHierarchy = try container.decodeIfPresent( [String].self, forKey: .tracesHierarchy) tracesDebugTags = try container.decodeIfPresent( [String].self, forKey: .tracesDebugTags) tracesFromUser = try container.decodeIfPresent( String.self, forKey: .tracesFromUser) tracesLc = try container.decodeIfPresent(String.self, forKey: .tracesLc) tracesTags = try container.decodeIfPresent( [String].self, forKey: .tracesTags) if container.contains(.unknownIngredientsN) { if try container.decodeNil(forKey: .unknownIngredientsN) { unknownIngredientsN = nil } else { if let intValue = try? container.decode( Float.self, forKey: .unknownIngredientsN) { unknownIngredientsN = intValue } else if let stringValue = try? container.decode( String.self, forKey: .unknownIngredientsN) { unknownIngredientsN = Float(stringValue) } else { // If decoding as both Float and String fails, handle the error accordingly throw DecodingError.dataCorruptedError( forKey: .unknownIngredientsN, in: container, debugDescription: "Unable to decode unknownIngredientsN" ) } } } else { unknownIngredientsN = nil } unknownNutrientsTags = try container.decodeIfPresent( [String].self, forKey: .unknownNutrientsTags) updateKey = try container.decodeIfPresent( String.self, forKey: .updateKey) vitaminsPrevTags = try container.decodeIfPresent( [String].self, forKey: .vitaminsPrevTags) vitaminsTags = try container.decodeIfPresent( [String].self, forKey: .vitaminsTags) // Check for null value if container.contains(.productQuantity) { if try container.decodeNil(forKey: .productQuantity) { productQuantity = nil } else { // Try to decode as Float if let floatValue = try? container.decode( Float.self, forKey: .productQuantity) { productQuantity = floatValue } else if let stringValue = try? container.decode( String.self, forKey: .productQuantity) { // If decoding as Float fails, try to decode as String productQuantity = Float(stringValue) } else { // If decoding as both Float and String fails, handle the error accordingly throw DecodingError.dataCorruptedError( forKey: .productQuantity, in: container, debugDescription: "Unable to decode productQuantity" ) } } } else { productQuantity = nil } productQuantityUnit = try container.decodeIfPresent( String.self, forKey: .productQuantityUnit) // ... (initialize other properties) } }