java无法替换json中的换行_如何处理JSON中的换行符?

A string is a sequence of Unicode code points wrapped with quotation marks(U+0022). All characters may be placed within the quotation marks except for the

characters that must be escaped: quotation mark (U+0022), reverse solidus(U+005C), and the control characters U+0000 to U+001F. There are two-character

escape sequence representations of some characters.

所以你不能直接传递0x0A或0x0C编码。这是被禁止的!规格建议使用的转义序列用于从一些明确定义的代码U+0000来U+001F:\f  represents the form feed character (U+000C). \n  represents the line feed character (U+000A).

由于大多数编程语言都\用于引用,你应该转义转义语法(双转义 - 一次用于语言/平台,一次用于Json本身):jsonStr = "{ \"name\": \"Multi\\nline.\" }";

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值