How can I return a Dictionary<string, Object> as JsonResult, AND get the proper result in JavaScript? How can I return a Dictionary<string, Object> as JsonResult, AND get the proper result in JavaScript? json json

How can I return a Dictionary<string, Object> as JsonResult, AND get the proper result in JavaScript?


Addendum: while writing the above question, it occurred to me that the translation between 'bad' array and 'good' array is indeed very simple:

    function translateAjaxResult(ret) {        var result = new Array();        if (ret == null) return result;        for(var i = 0; i < ret.length; i++)            result[ret[i].Key] = ret[i].Value;        return result;    }

Nonetheless, it's still a patch to a problem and not a fix to a problem, so I'd still like a more elegant solution.