Salesforce Rest接口返回值用Json序列化存在反斜杠

https://developer.salesforce.com/forums/?id=906F0000000fxruIAA

  • 如果接口返回值为JSON.serialize(object),则返回json会带’/’.例如
"[{\"City\":\"New York\"}]
  • 解决方案:使用RestContext,response返回值
RestContext.response.addHeader('Content-Type', 'application/json');
RestContext.response.responseBody = Blob.valueOf(locationJSON);

猜你喜欢

转载自blog.csdn.net/rosechan/article/details/79403547