我需要将 JSON 数据发布到包含 URL 的 MVC 控制器。JSON 数据看起来像是在查询字符串 (=) 处拆分的
JSON 数据如下所示:
"{"Files":[{"Title":"test","OriginalFileName":"",
"FileName":"http://company.domain.com/auth.aspx?enrollmentkey=APK54cd1546a8454d4ca79ded89a78f8698",
"Categories":[{"CategoryId":76,"SubCategoryId":182,"CatId":"CatId0"}],
"TypeId":"84",
"Tags":["Select Tag(s)..."],
"TagIds":[],
"Roles":[],
"MemberOnly":false,
"ContentTypeId":7,
"Id":0,
"IsPublished":true,
"PublishDate":""}]}"
调试,我看到它被分成
密钥(Request.Form.GetKey(0)):
{"Files":[{"Title":"Test","OriginalFileName":"","FileName":"http://company.domain.com/auth.aspx?enrollmentkey
值(Request.Form.GetValue(0)):
APK54cd1546a8454d4ca79ded89a78f8698","Categories":[{"CategoryId":110,"SubCategoryId":111,"CatId":"CatId0"}],"TypeId":"69","Tags":["Select Tag(s)..."],"TagIds":[],"Roles":[],"MemberOnly":false,"ContentTypeId":7,"Id":0,"IsPublished":true,"PublishDate":""}]}
JSON 数据是否需要在 = 处转义,还是需要对整个内容进行编码,或者我是否遗漏了什么?
我应该注意我正在使用淘汰赛的 ko.toJSON(js) 来创建 JSON,尽管我不确定这是否相关。
我还注意到 chrome 开发工具似乎也可以识别 Key-Val 拆分: