如何使用对象映射器从JSON字符串中删除反斜杠
以下是使用对象映射器从对象获取Json字符串的代码:如何使用对象映射器从JSON字符串中删除反斜杠,json,swift,objectmapper,Json,Swift,Objectmapper,以下是使用对象映射器从对象获取Json字符串的代码: let jsonString = Mapper().toJSONString(freechargeRequest) 但输出带有反斜杠,如下所示: “{\'region\\”:“http:\/\/testrm.getquickride.com:8080\/dishaapiserver\/qr\u freechare\u failure.do\”,“merchantId\”:“8mILp0KGOdEG57\”,“productInfo\”:“a
let jsonString = Mapper().toJSONString(freechargeRequest)
但输出带有反斜杠,如下所示:
“{\'region\\”:“http:\/\/testrm.getquickride.com:8080\/dishaapiserver\/qr\u freechare\u failure.do\”,“merchantId\”:“8mILp0KGOdEG57\”,“productInfo\”:“auth\”,“mobile\:“1357924680\”,“channel\”:“IOS\”,“amount\:“amount\”:“200\,“surl\”:“http:\/\/testrm.getaaquickride.com:“auth\”,“freedishu\”,“freedishu\”,“freedishu\”,“freedishu\”,“http:\”http:\”,“http:\”,“http://testrm.getaapiserver.getqui510420180705115938\“}”
我希望输出的JSON字符串中没有反斜杠。可能相关:@AhmadF我尝试过使用它,但不太可能反斜杠是虚拟的,能够在文本字符串中打印双引号。