0

考虑这段代码:

// Dictionary created.

Dictionary<string, string> objDic = new Dictionary<string, string>();
string test = "<>";
objDic.Add("html", test);

var Json = new JavaScriptSerializer();

string response = Json.Serialize(return_obj);

输出响应:

[{"html":"\u003c\u003e"}]

预期响应:

[{"html":"<>"}]

如何获得预期的响应?

4

1 回答 1

2

然后你可以使用Json.NET

var str = JsonConvert.SerializeObject(new {html="<>"}) //returns {"html":"<>"}
于 2012-05-11T06:08:34.177 回答