开发者

how to make Json lib generate such string: \/Date(1317375052044)\/

开发者 https://www.devze.com 2023-04-09 20:23 出处:网络
My target is to generate such json string: {\"EndTime\": \"\\/Date(1309737600000)\\/\"} I define a HashMap to generate the string

My target is to generate such json string: {"EndTime": "\/Date(1309737600000)\/"}

I define a HashMap to generate the string

If I define the string value as "\\/Date(1317375052044)\\/" then the result is "\\\\/Date(1317375052044)\\\\/".

If I define the string as "/Date(1317375052044)/" then the result is "/Date(1317375052044)/".

How I can generat开发者_如何学Goe the result "\/Date(1309737600000)\/"?


Duplicated from How should I escape strings in JSON? . Following this response try defining the string as "\\\\/Date(1317375052044)\\\\/" because in Java String '\' is also a escape character!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号