我有一项服务以以下格式返回我的 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}]