How to convert the following JSON string into a dictionary C#

I am trying to convert the following JSON response string into a C# Dictionary<string,string>

{
  {
  "type": "Select",
  "name": "timezone",
  "label": "Timezone",
  "description": "Select the city closest to you that shares your same timezone.",
  "multiOptions": {
    "US/Pacific": "(UTC-8) Pacific Time (US & Canada)",
    "US/Mountain": "(UTC-7) Mountain Time (US & Canada)",
    "US/Central": "(UTC-6) Central Time (US & Canada)",
    "US/Eastern": "(UTC-5) Eastern Time (US & Canada)",
    "America/Halifax": "(UTC-4)  Atlantic Time (Canada)",
    "America/Anchorage": "(UTC-9)  Alaska (US & Canada)",
    "Pacific/Honolulu": "(UTC-10) Hawaii (US)",
    "Pacific/Samoa": "(UTC-11) Midway Island, Samoa",
    "Etc/GMT-12": "(UTC-12) Eniwetok, Kwajalein",
    "Canada/Newfoundland": "(UTC-3:30) Canada/Newfoundland",
    "America/Buenos_Aires": "(UTC-3) Brasilia, Buenos Aires, Georgetown",
    "Atlantic/South_Georgia": "(UTC-2) Mid-Atlantic",
    "Atlantic/Azores": "(UTC-1) Azores, Cape Verde Is.",
    "Europe/London": "Greenwich Mean Time (Lisbon, London)",
    "Europe/Berlin": "(UTC+1) Amsterdam, Berlin, Paris, Rome, Madrid",
    "Europe/Athens": "(UTC+2) Athens, Helsinki, Istanbul, Cairo, E. Europe",
    "Europe/Moscow": "(UTC+3) Baghdad, Kuwait, Nairobi, Moscow",
    "Iran": "(UTC+3:30) Tehran",
    "Asia/Dubai": "(UTC+4) Abu Dhabi, Kazan, Muscat",
    "Asia/Kabul": "(UTC+4:30) Kabul",
    "Asia/Yekaterinburg": "(UTC+5) Islamabad, Karachi, Tashkent",
    "Asia/Calcutta": "(UTC+5:30) Bombay, Calcutta, New Delhi",
    "Asia/Katmandu": "(UTC+5:45) Nepal",
    "Asia/Omsk": "(UTC+6) Almaty, Dhaka",
    "India/Cocos": "(UTC+6:30) Cocos Islands, Yangon",
    "Asia/Krasnoyarsk": "(UTC+7) Bangkok, Jakarta, Hanoi",
    "Asia/Hong_Kong": "(UTC+8) Beijing, Hong Kong, Singapore, Taipei",
    "Asia/Tokyo": "(UTC+9) Tokyo, Osaka, Sapporto, Seoul, Yakutsk",
    "Australia/Adelaide": "(UTC+9:30) Adelaide, Darwin",
    "Australia/Sydney": "(UTC+10) Brisbane, Melbourne, Sydney, Guam",
    "Asia/Magadan": "(UTC+11) Magadan, Soloman Is., New Caledonia",
    "Pacific/Auckland": "(UTC+12) Fiji, Kamchatka, Marshall Is., Wellington"
  }
}

Using Newtonsoft JSON library, I cannot figure out how to do this. Using online converters, it creates a class called MultiOptions, and then puts all of those as properties.



Read more here: https://stackoverflow.com/questions/64950103/how-to-convert-the-following-json-string-into-a-dictionary-c-sharp

Content Attribution

This content was originally published by ordertochaos at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: