public void CreateObject() { NameValueCollection nvc = new NameValueCollection(); nvc.Add("one", "1"); nvc.Add("two", "2"); nvc.Add("v1", "1.0"); IDictionary <string, object> obj = ApiUtil.CreateJsonSerializableObject(nvc); Assert.Equal("1", obj["one"]); Assert.Equal("2", obj["two"]); Assert.Equal("1.0", obj["v1"]); string json = JsonConvert.SerializeObject(obj); obj = JsonConvert.DeserializeObject <IDictionary <string, object> >(json); Assert.Equal("1", obj["one"]); Assert.Equal("2", obj["two"]); Assert.Equal("1.0", obj["v1"]); Assert.Equal(3, obj.Count); }