Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "data": {
- "countries": [
- {
- "translatedName": "Ascension Island",
- "translations": [
- {
- "languageCode": "bg-BG",
- "translatedName": "Остров Възнесение"
- },
- {
- "languageCode": "cs-CZ",
- "translatedName": "Ascension"
- }
- ]
- }
- }
- class Country
- {
- public string TranslatedName { get; set; }
- public List<Dictionary<string, string>> Translations { get; set;
- }
- public T Parse<T>(string fieldName, string json)
- {
- }
- public T Parse<T>(string fieldName, string json)
- {
- return JObject.Parse(json)[fieldName].ToObject<T>();
- }
- var countries = Parse<List<Country>>("countries", ....); //it fails due to the fact it does not know how to convert translations to dictionary
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement