【发布时间】:2010-04-18 15:51:23
【问题描述】:
我正在使用 C# 将 JSON 发送到 PHP 脚本,如下所示:
string json = "{";
json += "\"prop\":\"some text\"";
json += "}";
PostSubmitter post = new PostSubmitter();
post.Url = "http://localhost/synch/notein.php";
post.Type = PostSubmitter.PostTypeEnum.Post;
post.PostItems.Add("note", json);
post.Post();
当然,我必须转义内部引号,但它们会被发送到脚本!更糟糕的是:有文本已经有引号,所以必须将它们转义为有效的 JSON。在这种情况下,我希望传输反斜杠。有什么想法可以实现吗?
【问题讨论】:
标签: c# .net json http-post backslash