ciki
V2EX  ›  Java

springboot 返回的字符串被自动转义怎么处理啊?

  •  
  •   ciki · Aug 17, 2021 · 1686 views
    This topic created in 1926 days ago, the information mentioned may be changed or developed.
    "data":{"id":1,"description":"测试啊测试!\\n\\n 期待测试!"}}

    数据库的数据是测试啊测试!\n\n 期待测试!

    返回 json 后变成了\\n\\n 导致解析失败。

    这种情况怎么处理啊
    passer9527
    passer9527
    Aug 19, 2021 via iPhone
    1
    这个不是 springboot 的问题,而是你返回前,这个字段的值已经被加上了多余斜线。仔细看看是哪个步骤加的
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   4815 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 02:24 · PVG 10:24 · LAX 18:24 · JFK 21:24
    ♥ Do have faith in what you're doing.