C# Serialize Dictionary to JSON

后端 未结 3 1833
没有蜡笔的小新
没有蜡笔的小新 2021-02-14 08:54

I am trying to serialize a Dictionary to JSON, and get the following exception:

new JavaScriptSerializer().Serialize(mydict)`

Ty

3条回答
  •  遥遥无期
    2021-02-14 09:34

    The blog http://dukelupus.wordpress.com/2011/05/04/asp-net-mvc-json-and-a-generic-dictionary/ describes an extension method Dictionary ToJsonDictionary(this Dictionary input)

提交回复
热议问题