Answers for "convert dictionary to json c#"

2

c# convert dictionary to anonymous object

var dict = new Dictionary<string, object> { { "Property", "foo" } };
dynamic eo = dict.Aggregate(new ExpandoObject() as IDictionary<string, Object>,
                            (a, p) => { a.Add(p.Key, p.Value); return a; });
string value = eo.Property;
Posted by: Guest on May-21-2020
5

c# convert list to string

string combindedString = string.Join( ",", myList.ToArray() );
Posted by: Guest on May-16-2020
1

swift convert dictionary to json

let dic = ["2": "B", "1": "A", "3": "C"]
let encoder = JSONEncoder()
if let jsonData = try? encoder.encode(dic) {
    if let jsonString = String(data: jsonData, encoding: .utf8) {
        print(jsonString)
    }
}
Posted by: Guest on January-29-2020
0

c# json to dictionary

string json = @"{""key1"":""value1"",""key2"":""value2""}";

var values = JsonConvert.DeserializeObject<Dictionary<string, string>>(json);
Posted by: Guest on March-24-2020
0

c# dictionary to json

return JsonConvert.SerializeObject( myDictionary );
Posted by: Guest on September-01-2021

Code answers related to "convert dictionary to json c#"

Code answers related to "Swift"

Browse Popular Code Answers by Language