Created
May 7, 2018 10:26
-
-
Save MirzaMerdovic/c36822fc0552b108ec2c47d9760850a4 to your computer and use it in GitHub Desktop.
Convert Newtonsoft.Json.Linq.JArray to System.Collections.Generic.Dictionary<,>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// If you have a serialized dictionary in your configuration for example, something like this: | |
// "dictionary": [{"1":"asda"}, {"2":"qweww"}, {"3":{"awdsd333"}] | |
Dictionary<int, string> parameters = | |
((JArray)serializedJArray) | |
.Children<JObject>() | |
.ToDictionary(x => int.Parse(x.Properties().First().Name), x => x.Properties().First().Value.ToString()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment