how to convert NameValueCollection to JSON string?
I tried: NameValueCollection Data = new NameValueCollection(); Data.Add("foo","baa"); string json = new JavaScriptSerializer().Serialize(Data); it returns: ["foo"] I expected {"foo" : "baa"} How do I to do this? NameValueCollection isn't an IDictionary, so the JavaScriptSerializer cannot serialize it as you expect directly. You'll need to first convert it into a dictionary, then serialize it. Update : following questions regarding multiple values per key, the call to nvc[key] will simply return them separated by a comma, which may be ok. If not, one can always call GetValues and decide what to