排除“使用StringesCapeutils.escapehtml4时

发布于 2025-01-28 10:27:59 字数 636 浏览 3 评论 0原文

我正在尝试消毒请求机构。为此,我将对象转换为JSON,然后将JSON转换为

requestBody

{
  "data": {
    "id": "123",
    "unit_id": "456",
    "country": "jp",
    }
}

stringescapeutils.escapehtml

输出后逃脱:

{"data":{"id":"123","unit_id":"456","country":"jp"}}

当我尝试将JSON转换回对象时,它正在逃脱双引号(“),它正在破坏JSON结构。

在此过程中,我如何单独排除双引号(“)?

I am trying to Sanitize the requestBody. For this purpose I am converting Object to Json and then passing the Json to

requestBody

{
  "data": {
    "id": "123",
    "unit_id": "456",
    "country": "jp",
    }
}

StringEscapeUtils.escapeHtml

Output post escaping:

{"data":{"id":"123","unit_id":"456","country":"jp"}}

It is escaping the double quotes(“) which is breaking the Json structure when I am trying convert the Json back to Object.

How I can exclude double quotes(“) alone during this process?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文