Json format keyvalues only

Apr 23, 2013 at 8:43 PM
Hello How to get the following format using JSON.NET?

{
"123": "CustomerA",
"345":"CustomerB",
"789":"CustomerC"
}

Currently when I Serialize my object I get the data in the following format
[
{
Name: "CustomerA",
ID: "123"
}
{
Name: "CustomerB",
ID: "345"
}
etc etc
]
Jun 5, 2013 at 2:53 PM
Edited Jun 5, 2013 at 3:03 PM
I am sure there is a reason not to do this... but I use a helper (.ashx) file like this
public void ProcessRequest(HttpContext context)
{
    context.Response.ContentType = "application/json";
    Dictionary<String, String> dictionary = new Dictionary<String, String>();

    dictionary.Add("123", "CustomerA");
    dictionary.Add("345", "CustomerB");
    dictionary.Add("789", "CustomerC");

    context.Response.Write(JsonConvert.SerializeObject(dictionary));
}
Then the client does something like
        success: (function (result) {
            for (var key in result)
                alert(key + ' ' + result[key]);