get second JSON value knowing the first one

Dear Stackoverflow contributors, I’ve got the following JSON file, translation.json, containing a key called “greeting” and a value containing the language the greeting is written in.

{ "greeting": {
    
        "af" : "Hallo (Afrikaans)",
        "af_NA" : "Hallo (Afrikaans - Namibia)",
        "af_ZA" : "Hallo (Afrikaans - South Afica)",
        
        "as" : "হ্যালো (Assamese)",
        "as_IN" : "হ্যালো (Assamese - India)",
        
        "sq" : "Përshëndetje (Albanian)",
        "sq_AL" : "Përshëndetje (Albanian - Albania)",
        "sq_XK" : "Përshëndetje (Albanian - Kosovo)",
        "sq_MK" : "Përshëndetje (Albanian - Macedonia)",
        
        "am" : "ሰላም (Amharic)", 
        "am_ET" : "ሰላም (Amharic - Ethiopia) ",

        "ar" : "أهلا (Arabic)",
        "ar_DZ" : "أهلا (Arabic - Algeria)",
        "ar_BH" : "أهلا (Arabic - Bahrain)",
        "ar_TD" : "أهلا (Arabic - Chad)",
        "ar_KM" : "أهلا (Arabic - Comoros)",
        "ar_DJ" : "أهلا (Arabic - Djibouti)",
        "ar_EG" : "أهلا (Arabic - Egypt)",
        "ar_ER" : "أهلا (Arabic - Eritrea)",
        "ar_IQ" : "أهلا (Arabic - Iraq)",
        "ar_IL" : "أهلا (Arabic - Israel)",
        "ar_JO" : "أهلا (Arabic - Jordan)",
        "ar_KW" : "أهلا (Arabic - Kuwait)",
        "ar_LB" : "أهلا (Arabic - Lebanon)",
        "ar_LY" : "أهلا (Arabic - Libya)",
        "ar_MR" : "أهلا (Arabic - Mauritania)",
        "ar_MA" : "أهلا (Arabic - Morocco)",
        "ar_OM" : "أهلا (Arabic - Oman)",
        "ar_PS" : "أهلا (Arabic - Palestinian Territories)",
        "ar_QA" : "أهلا (Arabic - Qatar)",
        "ar_SA" : "أهلا (Arabic - Saudi Arabia)",
        "ar_SO" : "أهلا (Arabic - Somalia)",
        "ar_SS" : "أهلا (Arabic - South Sudan)",
        "ar_SD" : "أهلا (Arabic - Sudan)",
        "ar_SY" : "أهلا (Arabic - Syria)",
        "ar_TN" : "أهلا (Arabic - Tunisia)",
        "ar_AE" : "أهلا (Arabic - UAE)",
        "ar_EH" : "أهلا (Arabic - Western Sahara)",
        "ar_YE" : "أهلا (Arabic - Yemen)",
        
        "hy" : "Բարեւ Ձեզ (Armenian)",
        "hy_AM" : "Բարեւ Ձեզ (Armenian - Armenia)",
        
        "az" : "Salam (Azerbaijani)",
        "az_AZ" : "Salam (Azerbaijani - Azerbaijan)",
        "az_Cyrl_AZ" : "Salam (Cyrillic Azerbaijani - Azerbaijan)",
        "az_Cyrl" : "Salam (Azerbaijani - Cyrillic)",
        "az_Latn" : "Salam (Azerbaijani - Latin)",
        
        "eu" : "Kaixo (Basque)",
        "eu_ES" : "Kaixo (Basque - Spain)",
        
        "be" : "добры дзень (Belarusian)",
        "be_BY" : "добры дзень (Belarusian - Belarus)",
        
        "bn" : "হ্যালো (Bengali)",
        "bn_BD" : "হ্যালো (Benga - Bangladesh)",
        "bn_IN" : "হ্যালো (Benga - India)",

        "bs" : "zdravo (Bosnian)",
        "bs_BA" : "zdravo (Bosnian - Bosinia & Herzvgovina)",
        "bs_Cyrl_BA" : "zdravo (Cyrillic Bosnian - Bosinia & Herzvgovina)",
        "bs_Latn" : "zdravo (Bosnian - Latin)",

        "bg" : "Здравейте (Bulgarian)",
        "bg_BG" : "Здравейте (Bulgarian - Bulgaria)",
        
        "ca" : "Hola (Catalan)", 
        "ca_AD" : "Hola (Catalan - Andorra)", 
        "ca_FR" : "Hola (Catalan - France)", 
        "ca_IT" : "Hola (Catalan - Italy)", 
        "ca_ES" : "Hola (Catalan - Spain)", 

        "zh" : "你好呀 (Simplified Chinese)",
        "zh_CN" : "你好呀 (Simplified Chininese - China)",
        "zh_HK" : "你好呀 (Simplified Chinese - Simplified)",
        "zh_MO" : "你好呀 (Simplified Chinese - Macau)",
        "zh_Hans_CN" : "你好呀 (Simplified Chininese - China)",
        "zh_Hans_HK" : "你好呀 (Simplified Chininese - Hong Kong)",
        "zh_Hans_MO" : "你好呀 (Simplified Chininese - Macau)",
        "zh_Hans_SG" : "你好呀 (Simplified Chininese - Singapore)",
        "zh_Hans" : "你好呀 (Simplified Chinese)",
        "zh_SG" : "你好呀 (Simplified Chinese - Singapore)",
        "zh_TW" : "你好 (Traditional Chinese - Taiwan)",
        "zh_Hant_HK" : "你好 (Traditional Chininese - Hong Kong)",
        "zh_Hant_MO" : "你好 (Traditional Chininese - Macau)",
        "zh_Hant_TW" : "你好 (Traditional Chininese - Taiwan)",
        "zh_Hant" : "你好呀 (Traditional Chinese)",
        
        "hr" : "Pozdrav tamo (Croatian)",
        "hr_BA" : "Pozdrav tamo (Croatian - Bosnia & Herzvgovina)",
        "hr_HR" : "Pozdrav tamo (Croatian - Croatia)",

        "cs" : "Ahoj (Czech)",
        "cs_CZ" : "Ahoj (Czech - Czech Republic)",

        "da" : "Hej (Danish)",
        "da_DK" : "Hej (Danish Denmark)",
        "da_GL" : "Hej (Danish - Greenland)",

        "nl" : "Hallo (Dutch)",
        "nl_AW" : "Hallo (Dutch - Aruba)",
        "nl_BE" : "Hallo (Dutch - Belgium)",
        "nl_BQ" : "Hallo (Dutch - Caribbean Netherlands)",
        "nl_CW" : "Hallo (Dutch - Curaçao)",
        "nl_NL" : "Hallo (Dutch - Netherlands)",
        "nl_SX" : "Hallo (Dutch - Sint Marteen)",
        "nl_SR" : "Hallo (Dutch - Suriname)",

        "en" : "hello (English)",
        "en_GB" : "hello (English - UK)",
        "en_US" : "hello (English - USA)",
        "en_IN" : "hello (English - India)",
        "en_AS" : "hello (English - American Samoa)",
        "en_AI" : "hello (English - Anguilla)",
        "en_AG" : "hello (English - Antigue & Barbuda)",
        "en_AU" : "hello (English - Australia)",
        "en_BS" : "hello (English - Bahamas)",
        "en_BB" : "hello (English - Barbados)",
        "en_BE" : "hello (English - Belgium)",
        "en_BZ" : "hello (English - Belize)",
        "en_BM" : "hello (English - Bermuda)",
        "en_BW" : "hello (English - Botswana)",
        "en_IO" : "hello (English - British Indian Ocean Territory)",
        "en_VG" : "hello (English - British Virgin Islands)",
        "en_CM" : "hello (English - Cameroon)",
        "en_CA" : "hello (English - Canada)",
        "en_KY" : "hello (English - Cayman Islands)",
        "en_CX" : "hello (English - Christmas Island)",
        "en_CC" : "hello (English - Cocos Island)",
        "en_CK" : "hello (English - Cook Islands)",
        "en_DG" : "hello (English - Diego Garcia)",
        "en_DM" : "hello (English - Dominica)",
        "en_ER" : "hello (English - Eritrea)",
        "en_FK" : "hello (English - Falkland Islands)",
        "en_FJ" : "hello (English - Fiji)",
        "en_GM" : "hello (English - Gambia)",
        "en_GH" : "hello (English - Ghana)",
        "en_GI" : "hello (English - Gibraltar)",
        "en_GD" : "hello (English - Granada)",
        "en_GU" : "hello (English - Guam)",
        "en_GG" : "hello (English - Guernsey)",
        "en_GY" : "hello (English - Guyana)",
        "en_HK" : "hello (English - Hong Kong)",
        "en_IE" : "hello (English - Ireland)",
        "en_IM" : "hello (English - Isle of Man)",
        "en_JM" : "hello (English - Jamaica)",
        "en_JE" : "hello (English - Jersey)",
        "en_KE" : "hello (English - Kenya)",
        "en_KI" : "hello (English - Kiribati)",
        "en_LS" : "hello (English - Lesotho)",
        "en_LR" : "hello (English - Liberia)",
        "en_MO" : "hello (English - Macau)",
        "en_MG" : "hello (English - Madagascar)",
        "en_MW" : "hello (English - Malawi)",
        "en_MY" : "hello (English - Malaysia)",
        "en_MT" : "hello (English - Malta)",
        "en_MH" : "hello (English - Marshall Islands)",
        "en_MU" : "hello (English - Mauritius)",
        "en_FM" : "hello (English - Micronesia)",
        "en_MS" : "hello (English - Montserrat)",
        "en_NA" : "hello (English - Namibia)",
        "en_NR" : "hello (English - Nauru)",
        "en_NZ" : "hello (English - New Zealand)",
        "en_NG" : "hello (English - Nigeria)",
        "en_NU" : "hello (English - Niue)",
        "en_NF" : "hello (English - Norfolk Island)",
        "en_MP" : "hello (English - Northern Mariana Islands)",
        "en_PK" : "hello (English - Pakistan)",
        "en_PW" : "hello (English - Palau)",
        "en_PG" : "hello (English - Papua New Guinea)",
        "en_PH" : "hello (English - Philippines)",
        "en_PN" : "hello (English - Pitcairn Islands)",
        "en_PR" : "hello (English - Puerto Rico)",
        "en_RW" : "hello (English - Rwanda)",
        "en_WS" : "hello (English - Samoa)",
        "en_SC" : "hello (English - Seychelles)",
        "en_SL" : "hello (English - Sierra Leone)",
        "en_SG" : "hello (English - Singapore)",
        "en_SX" : "hello (English - Sint Maarten)",
        "en_SB" : "hello (English - Solomon Islands)",
        "en_ZA" : "hello (English - South Africa)",
        "en_SS" : "hello (English - South Sudan)",
        "en_SH" : "hello (English - St. Helena)",
        "en_KN" : "hello (English - St. Kitts & Nevis)",
        "en_LC" : "hello (English - St. Lucia)",
        "en_VC" : "hello (English - St. Vincent & Grenadines)",
        "en_SD" : "hello (English - Sudan)",
        "en_SZ" : "hello (English - Swaziland)",
        "en_TZ" : "hello (English - Tanzainia)",
        "en_TK" : "hello (English - Tokelau)",
        "en_TO" : "hello (English - Tonga)",
        "en_TT" : "hello (English - Trinidad & Tobago)",
        "en_TC" : "hello (English - Turks & Caicos Islands)",
        "en_TV" : "hello (English - Tuvalu)",
        "en_UM" : "hello (English - U.S. Outlying Islands)",
        "en_VI" : "hello (English - U.S. Virgin Islands)",
        "en_UG" : "hello (English - Uganda)",
        "en_VU" : "hello (English - Vanuatu)",
        "en_ZM" : "hello (English - Zambia)",
        "en_ZW" : "hello (English - Zimbabwe)",
        
        "eo" : "Saluton (Esperanto)",
        
        "et" : "Tere (Estonian)",
        "et_EE" : "Tere (Estonian - Estonia)",

        "fil" : "Kamusta (Filipino)",
        "fil_PH" : "Kamusta (Filipino - Philippines)",

        "fi" : "Hei (Finnish)",
        "fi_FI" : "Hei (Finnish - Finland)",

        "fr" : "Bonjour (French)",
        "fr_DZ" : "Bonjour (French - Algeria)",
        "fr_BE" : "Bonjour (French - Belgium)",
        "fr_BJ" : "Bonjour (French - Benin)",
        "fr_BF" : "Bonjour (French - Burkina Faso)",
        "fr_BI" : "Bonjour (French - Burundi)",
        "fr_CM" : "Bonjour (French - Cameroon)",
        "fr_CA" : "Bonjour (French - Canada)",
        "fr_CF" : "Bonjour (French - Central African Republic)",
        "fr_TD" : "Bonjour (French - Chad)",
        "fr_KM" : "Bonjour (French - Comoros)",
        "fr_CG" : "Bonjour (French - Congo-Brazzaville)",
        "fr_CD" : "Bonjour (French - Congo-Kinshasa)",
        "fr_CI" : "Bonjour (French - Côte d'Ivoire)",
        "fr_DJ" : "Bonjour (French - Dijibouti)",
        "fr_CQ" : "Bonjour (French - Equatorial Guinea)",
        "fr_FR" : "Bonjour (French - France)",
        "fr_GF" : "Bonjour (French - French Guiana)",
        "fr_PF" : "Bonjour (French - French Polynesia)",
        "fr_GA" : "Bonjour (French - Gabon)",
        "fr_GP" : "Bonjour (French - Guadeloupe)",
        "fr_GN" : "Bonjour (French - Guinea)",
        "fr_HT" : "Bonjour (French - Haiti)",
        "fr_LU" : "Bonjour (French - Luxembourg)",
        "fr_MG" : "Bonjour (French - Madagascar)",
        "fr_ML" : "Bonjour (French - Mali)",
        "fr_MQ" : "Bonjour (French - Martinque)",
        "fr_MR" : "Bonjour (French - Mauritania)",
        "fr_MU" : "Bonjour (French - Mauritius)",
        "fr_YT" : "Bonjour (French - Mayotte)",
        "fr_MC" : "Bonjour (French - Monaco)",
        "fr_MA" : "Bonjour (French - Marocco)",
        "fr_NC" : "Bonjour (French - New Caledonia)",
        "fr_NE" : "Bonjour (French - Niger)",
        "fr_RE" : "Bonjour (French - Reùnion)",
        "fr_RW" : "Bonjour (French - Rwanda)",
        "fr_SN" : "Bonjour (French - Senegal)",
        "fr_SC" : "Bonjour (French - Seychelles)",
        "fr_BL" : "Bonjour (French - Barthélemy)",
        "fr_MF" : "Bonjour (French - St. Martin)",
        "fr_PM" : "Bonjour (French - St. Pierre & Miquelon)",
        "fr_CH" : "Bonjour (French - Switzerland)",
        "fr_SY" : "Bonjour (French - Syria)",
        "fr_TG" : "Bonjour (French - Togo)",
        "fr_TN" : "Bonjour (French - Tunisia)",
        "fr_VU" : "Bonjour (French - Vanuatu)",
        "fr_WF" : "Bonjour (French - Wallis & Futuna)",
       
        "gl" : "ola (Galician)",
        "gl_ES" : "ola (Galician - Spain)",
        
        "lg" : "ki kati? (Ganda)",
        "lg_UG" : "ki kati? (Ganda - Uganda)",

        "ka" : "გამარჯობა (Georgian)",
        "ka_GE" : "გამარჯობა (Georgian - Georgia)",
        
        "de" : "Hallo (German)",
        "de_AT" : "Hallo (German - Austria)",
        "de_BE" : "Hallo (German - Belgium)",
        "de_DE" : "Hallo (German - Germany)",
        "de_LI" : "Hallo (German - Liechtenstein)",
        "de_LU" : "Hallo (German - Luxembourg)",
        "de_CH" : "Hallo (German - Switzerland)",
        
        "el" : "Χαίρετε (Greek)",
        "el_CY" : "Χαίρετε (Greek - Cyprus)",
        "el_GR" : "Χαίρετε (Greek - Greece)",
        
        "gu" : "નમસ્તે (Gujarati)",
        "gu_IN" : "નમસ્તે (Gujarati - India)",
        
        "ha" : "Barka dai (Hausa)",
        "ha_GH" : "Barka dai (Hausa - Ghana)",
        "ha_Latn_GH" : "Barka dai (Latin Hausa - Ghana)",
        "ha_Latn_NE" : "Barka dai (Latin Hausa - Niger)",
        "ha_Latn_NG" : "Barka dai (Latin Hausa - Nigeria)",
        "ha_Latn" : "Barka dai (Latin Hausa)",
        "ha_NE" : "Barka dai (Hausa - Niger)",
        "ha_NG" : "Barka dai (Hausa - Nigeria)",
       
        "he" : "שלום (Hebrew)",
        "he_IL" : "שלום (Hebrew - Israel)",
        
        "hi" : "नमस्ते (Hindi)",
        "hi_IN" : "नमस्ते (Hindi - India)",
        
        "hu" : "Helló (Hungarian)",
        "hu_HU" : "Helló (Hungarian - Hungary)",
        
        "is" : "Halló (Icelandic)",
        "is_IS" : "Halló (Icelandic - Iceland)",
        
        "ig" : "Ndewo (Igbo)",
        "ig_NG" : "Ndewo (Igbo - Nigeria)",
        
        "id" : "Halo (Indonesian)",
        "id_ID" : "Halo (Indonesian - Indonesia)",
        
        "ga" : "Dia dhuit (Irish)",
        "ga_IE" : "Dia dhuit (Irish - Ireland)",

        "it" : "Ciao (Italian)",
        "it_IT" : "Ciao (Italian - Italy)",
        "it_SM" : "Ciao (Italian - San Marino)",
        "it_CH" : "Ciao (Italian - Switzerland)",
        
        "ja" : "こんにちは (Japanese)",
        "ja_JP" : "こんにちは (Japanese - Japan)",
        
        "kn" : "ಹಲೋ (Kannada)",   
        "kn_IN" : "ಹಲೋ (Kannada - India) ",   

        "kk" : "Сәлеметсіз бе (Kazakh)",
        "kk_Cyrl_KZ" : "Сәлеметсіз бе (Cyrillic Kazakh - Kazakistan)",
        "kk_Cyrl" : "Сәлеметсіз бе (Cyrillic Kazakh)",
        "kk_KZ" : "Сәлеметсіз бе (Kazakh - Kazakistan)",
        
        "km" : "សួស្តី (Khmer)",
        "km_KH" : "សួស្តី (Khmer - Cambodia)", 
        
        "rw" : "Mwaramutse (Kinyarwanda)",
        "rw_RW" : "Mwaramutse (Kinyarwanda - Rwanda)",
        
        "ko" : "안녕하세요 (Korean)",
        "ko_KP" : "안녕하세요 (Korean - North Korea)",
        "ko_KR" : "안녕하세요 (Korean - South Korea)",
         
        "lv" : "Sveiki (Latvian)",
        "lv_LV" : "Sveiki (Latvian - Latvia)",
        
        "lt" : "Sveiki (Lithuanian)",
        "lt_LT" : "Sveiki (Lithuanian - Lithuania)",
        
        "mk" : "Здраво (Macedonian)",
        "mk_MK" : "Здраво (Macedonian - Macedonia)",
        
        "mg" : "Salama (Malagasy)",
        "mg_MG" : "Salama (Malagasy - Madagascar)",
        
        "ms" : "Helo (Malay)",
        "ms_BN" : "Helo (Malay - Brunei)",
        "ms_Latn_BN" : "Helo (Latin Malay - Brunei)",
        "ms_Latn_MY" : "Helo (Latin Malay - Malaysia)",
        "ms_Latn_SG" : "Helo (Latin Malay - Singapore)",
        "ms_Latn" : "Helo (Latin Malay)",
        "ms_SG" : "Helo (Malay - Singapore)",
        
        "ml" : "ഹലോ (Malayalam)",
        "ml_IN" : "ഹലോ (Malayalam - India)",
        
        "mt" : "Bonġu (Maltese)",
        "mt_MT" : "Bonġu (Maltese - Malta)",
        
        "mr" : "नमस्कार (Marathi)", 
        "mr_IN" : "नमस्कार (Marathi - India)", 
        "mr_NP" : "नमस्कार (Marathi - Nepal)", 
        
        "ne" : "नमस्कार (Nepali)",
        "ne_IN" : "नमस्कार (Nepali - India)",
        
        "or" : "ନମସ୍କାର (Oriya)",
        "or_IN" : "ନମସ୍କାର (Oriya - India)",
        
        "ps" : "سلام (Pashto)",
        "ps_AF" : "سلام (Pashto - Afghanistan)",
        
        "fa" : "سلام (Persian)",
        "fa_AF" : "سلام (Persian - Afghanistan)",
        "fa_IR" : "سلام (Persian - Iran)",
        
        "pl" : "cześć (Polish)",
        "pl_PL" : "cześć (Polish - Poland)",
        
        "pt" : "Olá (Portuguese)",
        "pt_AO" : "Olá (Portuguese - Angola)",
        "pt_BR" : "Olá (Portuguese - Brazil)",
        "pt_CV" : "Olá (Portuguese - Cape Verde)",
        "pt_GW" : "Olá (Portuguese - Guinea-Bissau)",
        "pt_MO" : "Olá (Portuguese - Macau)",
        "pt_MZ" : "Olá (Portuguese - Mozambique)",
        "pt_PT" : "Olá (Portuguese - Portugal)",
        "pt_ST" : "Olá (Portuguese - Säo Tomé & Prìncipe",
        "pt_TL" : "Olá (Portuguese - Timor-Leste",
        
        "pa" : "ਸਤ ਸ੍ਰੀ ਅਕਾਲ (Pashto)",
        "pa_AF" : "ਸਤ ਸ੍ਰੀ ਅਕਾਲ (Pashto - Afghanistan)",
        
        "ro" : "Buna ziua (Romanian)",
        "ro_MD" : "Buna ziua (Romanian - Moldova)",
        "ro_RO" : "Buna ziua (Romanian - Romania)",
        
        "ru" : "Привет (Russian)",
        "ru_BY" : "Привет (Russian - Belarus)",
        "ru_KZ" : "Привет (Russian - Kazakhstan)",
        "ru_KG" : "Привет (Russian - Kyrgyzstan)",
        "ru_MD" : "Привет (Russian - Moldova)",
        "ru_RU" : "Привет (Russian - Russia)",
        "ru_UA" : "Привет (Russian - Ukraine)",
        
        "sr" : "Здраво (Serbian)",
        "sr_BA" : "Здраво (Serbian - Bosnia & Herzvgovina)",
        "sr_Cyrl_BA" : "Здраво (Cyrillic Serbian - Bosnia & Herzvgovina)",
        "sr_Cyrl_XK" : "Здраво (Cyrillic Serbian - Kosovo)",
        "sr_Cyrl_ME" : "Здраво (Cyrillic Serbian - Montenegro)",
        "sr_Cyrl_RS" : "Здраво (Cyrillic Serbian - Serbia)",
        "sr_Cyrl" : "Здраво (Cyrillic Serbian)",
        "sr_XK" : "Здраво (Serbian - Kosovo)",
        "sr_Latn_BA" : "Здраво (Latin Serbian - Bosnia & Herzvgovina)",
        "sr_Latn_XK" : "Здраво (Latin Serbian - Kosovo)",
        "sr_Latn_ME" : "Здраво (Latin Serbian - Montenegro)",
        "sr_Latn_RS" : "Здраво (Latin Serbian - Serbia)",
        "sr_Latn" : "Здраво (Latin Serbian)",
        "sr_ME" : "Здраво (Serbian - Montenegro)",
        "sr_RS" : "Здраво (Serbian - Serbia)",
       
        "sk" : "Ahoj (Slovak)",
        "sk_SK" : "Ahoj (Slovak - Slovakia)",
        
        "sl" : "zdravo (Slovenian)",
        "sl_SI" : "zdravo (Slovenian - Slovenia)",
        
        "so" : "hello (Somali)",
        "so_DJ" : "hello (Somali - Djibouti)",
        "so_ET" : "hello (Somali - Ethiopia)",
        "so_KE" : "hello (Somali - Kenya)",
        "so_SO" : "hello (Somali - Somalia)",
        
        "es" : "hola (Spanish)",
        "es_AR" : "hola (Spanish - Argentina)",
        "es_BO" : "hola (Spanish - Bolivia)",
        "es_IC" : "hola (Spanish - Canary Islands)",
        "es_EA" : "hola (Spanish - Ceuta & Melilla)",
        "es_CL" : "hola (Spanish - Chile)",
        "es_CO" : "hola (Spanish - Colombia)",
        "es_CR" : "hola (Spanish - Costa Rica)",
        "es_CU" : "hola (Spanish - Cuba)",
        "es_DO" : "hola (Spanish - Dominican Republic)",
        "es_EC" : "hola (Spanish - Ecuador)",
        "es_SV" : "hola (Spanish - El Salvador)",
        "es_CQ" : "hola (Spanish - Equatorial Guinea)",
        "es_GT" : "hola (Spanish - Guatemala)",
        "es_HN" : "hola (Spanish - Honduras)",
        "es_MX" : "hola (Spanish - Mexico)",
        "es_NI" : "hola (Spanish - Nicaragua)",
        "es_PA" : "hola (Spanish - Panama)",
        "es_PY" : "hola (Spanish - Paraguay)",
        "es_PE" : "hola (Spanish - Peru)",
        "es_PH" : "hola (Spanish - Philippines)",
        "es_PR" : "hola (Spanish - Puerto Rico)",
        "es_ES" : "hola (Spanish - Spain)",
        "es_US" : "hola (Spanish - United States)",
        "es_UY" : "hola (Spanish - Uruguay)",
        "es_VE" : "hola (Spanish - Venezuela)",
        
        "sw" : "hello (Swahili)",
        "sw_KE" : "hello (Swahili - Kenya)",
        "sw_TZ" : "hello (Swahili - Tanzania)",
        "sw_UG" : "hello (Swahili - Uganda)",
        
        "sv" : "Hej (Swedish)",
        "sv_AX" : "Hej (Swedish - Åland Islands)",
        "sv_FI" : "Hej (Swedish - Finland)",
        "sv_SE" : "Hej (Swedish - Sweden)",
        
        "ta" : "வணக்கம் (Tamil)",
        "ta_IN" : "வணக்கம் (Tamil - India)",
        "ta_MY" : "வணக்கம் (Tamil - Malaysia)",
        "ta_SG" : "வணக்கம் (Tamil - Singapore)",
        "ta_LK" : "வணக்கம் (Tamil - Sri Lanka)",
        
        "te" : "హలో (Telugu)",
        "te_IN" : "హలో (Telugu - India)",
        
        "th" : "สวัสดี (Thai)", 
        "th_TH" : "สวัสดี (Thai - Thailand)", 
        
        "tr" : "Merhaba (Turkish)",
        "tr_CY" : "Merhaba (Turkish - Cyprus)",
        "tr_TR" : "Merhaba (Turkish - Turkey)",
        
        "uk" : "Здравствуйте (Ukranian)",
        "uk_UA" : "Здравствуйте (Ukranian - Ukraina)",

        "uz" : "Salom (Uzbeck)",
        "uz_AF" : "Salom (Uzbeck - Afghanistan)",
        "uz_Arab_AF" : "Salom (Arabic Uzbeck - Afghanistan)",
        "uz_Arab" : "Salom (Uzbeck - Arabic)",
        "uz_Cyrl_UZ" : "Salom (Cyrillic Uzbeck - Uzbekistan)",
        "uz_Cyrl" : "Salom (Cyrillic Uzbeck)",
        "uz_Latn_UZ" : "Salom (Latin Uzbeck - Uzbekistan)",
        "uz_Latn" : "Salom (Latin Uzbeck)",
        "uz_UZ" : "Salom (Uzbeck - Uzbekistan)",

        "vi" : "xin chào (Vietnamese)",
        "vi_VN" : "xin chào (Vietnamese - Vietnam)",

        "cy" : "Helo (Welsh)",
        "cy_GB" : "Helo (Welsh - United Kingdom)",
        
        "yo" : "Pẹlẹ o (Yoruba)",
        "yo_BJ" : "Pẹlẹ o (Yoruba - Benin)",
        "yo_NG" : "Pẹlẹ o (Yoruba - Nigeria)",
        
        "zu" : "Sawubona (Zulu)",
        "zu_ZA" : "Sawubona (Zulu - South Africa)" 
    
    
} }

Now I’m looking for a way to put all these greetings in a select, giving the display value the value of the greeting, and as the value to insert in the DB the language code.

Is there a way to accomplish this?

Answer

Here’s what you’re looking for.

<select id="select"></select>

<script>
const greetings = {
  "af" : "Hallo (Afrikaans)",
  "af_NA" : "Hallo (Afrikaans - Namibia)",
  "af_ZA" : "Hallo (Afrikaans - South Afica)",
  "as" : "হ্যালো (Assamese)",
  "as_IN" : "হ্যালো (Assamese - India)",
}

const select = document.querySelector('#select');

Object.keys(greetings).forEach(language => {
  const option = document.createElement('option');
  option.value = language;
  option.innerHTML = greetings[language]
  select.appendChild(option);
})

</script>