我正在 VB.NET 中构建一个 Web 服务,我想使用 JSON 来回答。目前我的答案看起来像这样
{\"myVar1\" : \"From moscow\", \"myVar2\" : \"With love\"}
我希望能够使用“(和 CarriageReturn),并有这样的响应:
{"myVar1" : "From moscow", "myVar2" : "With love"}
如何避免“in \”的这种转码?
这是我的接口定义:
<OperationContract()>
<WebGet(UriTemplate:="/TemplateGet?ID={id}",
        ResponseFormat:=WebMessageFormat.Json, 
        BodyStyle:=WebMessageBodyStyle.Bare)>
Function TemplateGet(id As String) As String
我的回答是纯字符串:
Function TemplateGet(id As String) As String Implements ISearch.TemplateGet
    Dim reponse As String = "{""MyVar1"" : ""From moscow"", ""MyVar2"" : ""With love""}"
    Return reponse
End Function