错误的json格式

时间:2013-03-19 16:10:06

标签: c# json serialization

我有一个服务以下列格式返回json数据:     "[{\"Id\":3,\"Name\":\"name1\",\"Age\":30,\"Course\":\"course1\",\"SchoolName\":\"school1\",\"City\":\"city1\",\"Country\":\"country1\",\"BuildDate\":null}]"

但我认为这可能是我在客户问题上的根源,因为我觉得它更像是:

"[{"Id":3,"Name":"name1","Age":30,"Course":"course1","SchoolName":"school1","City":"city1","Country":"country1","BuildDate":null}]"

我正在以这种方式序列化:

string model = //mydata to serialize
string jsonStringToSend = new JavaScriptSerializer().Serialize(model);

我该如何解决这个问题?

更新

按照建议删除双序列化后,我现在开始:

[{Id:3, Name:name1, Age:30, Course:course1, SchoolName:school1, City:city1, Country:country1, BuildDate:null}]

1 个答案:

答案 0 :(得分:0)

\"用于转义"字符。如果按字面意思打印,您可能也会逃离\