Add binding to json using JavaScriptSerializer with list c#

I use to build my json return string by hand using vbscript and would add a binding, and then in javascript i could say something simple like


which would look like this in json

{"response":[{"key":"value"},{"key":"value"}] }

I just starting working with jquery ajax to in c# and i found the only way to make valid json in c# is to use the JavaScriptSerializer. This is fine, except im not sure how to get that type of binding when serializing my list. I only have one item in my json for testing

d=[{"h":"hi"}] //This is what shows in fiddler

i want it too look similar to the above

d={"response":[{"h":"hi"}] }

Im not sure how to create this type of json response object using c#, though i am sure it is possible. Here is the code for my test serialization.

private static string Serialize(object obj)
    JavaScriptSerializer serializer = new JavaScriptSerializer();
    return serializer.Serialize(obj);

public static string SomeMethod()
    List<Samp> samp = new List<Samp>()
        new Samp{h = "hi"}
    return Serialize(samp);


public class Samp
    public string h = "";


return Serialize( new { response = samp });

Need Your Help

Take a trac repository dump

trac dump

I have a trac repository available on a local network and need to take a dump of the trac data to be able to access it out of that network.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.