V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
ciki
V2EX  ›  Java

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

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

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

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

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