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TIsInRhYmxlTmFtZSI6Im50Y19wcm9kdWN0X2luZm8iLCJvYmplY3RJZCI6MTA3NDA0LCJ0cmFmZmljVGF4IjoyLCJ0cmFmZmljVHlwZSI6Miwic3RhcnRQb2ludCI6IuS4pOaxn+WbvemZheacuuWcuiIsImFycml2ZVBvaW50Ijoi5rWm5Lic5Zu96ZmF5py65Zy6Iiwic3RhcnRUaW1lIjoiMjAxMy0wOS0wNiAxMToxMDowMCIsImFycml2ZVRpbWUiOiIyMDEzLTA5LTA2IDEzOjIwOjAwIiwidHJhZmZpY051bWJlciI6IkhPMTE0OCIsInN0YXJ0QWlycG9ydFRlcm1pbmFsIjoiIiwiYXJyaXZlQWlycG9ydFRlcm1pbmFsIjoiVDIiLCJmbGlnaHRTdG9wRmxhZyI6MCwiZmxpZ2h0U3RvcEFpcnBvcnQiOiIiLCJmbGlnaHRTdG9wTWludXRlIjowLCJyZW1hcmsiOiIiLCJiZWdpbkNpdHkiOiLmoYLmnpciLCJhcnJpdmVDaXR5Ijoi5LiK5rW3IiwiYmVnaW5DaXR5Q29kZSI6NzA1LCJhcnJpdmVDaXR5Q29kZSI6MjUwMH1dLCJ0cmlwIjp7ImlkIjoyODU4MCwidGFibGVOYW1lIjoibnRjX3Byb2R1Y3RfaW5mbyIsIm9iamVjdElkIjoxMDc0MDQsImNvbnRlbnQiOiIifSwibmJCYXRjaEZsYWciOmZhbHNlLCJhdHRhY2hMaXN0IjpbXX0=";
BASE64Decoder decoder = new BASE64Decoder();
try {
log = new String(decoder.decodeBuffer(log));
System.out.println(log);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

结果是

{"orderInfo":{"id":107404,"orderId":2736421,"productCode":457373,"productName":"\u0026lt;桂林-象山-兴坪漓江-阳朔-蝴蝶泉双飞4日游\u0026gt;如画广西,小资阳朔","adultCount":4,"childCount":0,"startDate":"Sep 3, 2013 12:00:00 AM","endDate":"Sep 6, 2013 12:00:00 AM","vendorId":6688,"vendorName":"北海海外(上海办)","orderStatus":1,"routeType":1,"productSpecialist":"陈涛","productManager":"辛苗","contactName":"赵涛","orderSystemType":1,"sendStatus":1,"beginCityCode":2500,"confirmTime":"Aug 29, 2013 12:00:00 AM","status":1,"customerIds":"","confirmStatus":2,"delFlag":0},"productInfo":{"id":28406,"orderId":2736421,"sendType":"请携带有效证件原件,至少在起飞时间前90分钟抵达机场(黄金周期间建议提前120分钟),自行办理相关登机手续;航班办理中如遇到任何问题,请咨询机场工作人员或者打途牛电话:4007-999999转9号键。","sendPerson":"","sendPersonPhone":"","meetPersonPhone":"","meetType":"导游会于最晚您到达桂林当天和您联系,具体事宜以导游通知为。\nPS:导游人员会根据此团所有途牛会员的航班,在行程不减少的情况下,先后顺序会有所调整,敬请留意!","meetPerson":"","guideName":"","guidePhone":"","contactName":"娜娜(此线路投诉专员)","contactPhone":"13501786855","contactName1":"郑微","contactPhone1":"15977335656","venueMark":"","venueTime":"","venue":"","leaderName":"","leaderPhone":"","abroadVenueMark":"","hotelInfo":"","remark":"1、出游时,请携带出团通知书及签约行程,方便您查询相关信息;\n2、导游会在最晚出游当天和您联系,请保证手机信号通畅;旅途中如产生任何问题可随时致电此线路全程质量跟踪员——娜娜,她会第一时间解决您的问题。","notice":"","editMinute":0,"editSystemType":2,"updateUserName":"","updateTime":"Aug 29, 2013 11:55:25 AM","delFlag":0},"trafficList":[{"id":65091,"tableName":"ntc_product_info","objectId":107404,"trafficTax":1,"trafficType":2,"startPoint":"浦东国际机场","arrivePoint":"两江国际机场","startTime":"2013-09-03 08:00:00","arriveTime":"2013-09-03 10:20:00","trafficNumber":"HO1147","startAirportTerminal":"T2","arriveAirportTerminal":"","flightStopFlag":0,"flightStopAirport":"","flightStopMinute":0,"remark":"","beginCity":"上海","arriveCity":"桂林","beginCityCode":2500,"arriveCityCode":705},{"id":65092,"tableName":"ntc_product_info","objectId":107404,"trafficTax":2,"trafficType":2,"startPoint":"两江国际机场","arrivePoint":"浦东国际机场","startTime":"2013-09-06 11:10:00","arriveTime":"2013-09-06 13:20:00","trafficNumber":"HO1148","startAirportTerminal":"","arriveAirportTerminal":"T2","flightStopFlag":0,"flightStopAirport":"","flightStopMinute":0,"remark":"","beginCity":"桂林","arriveCity":"上海","beginCityCode":705,"arriveCityCode":2500}],"trip":{"id":28580,"tableName":"ntc_product_info","objectId":107404,"content":""},"nbBatchFlag":false,"attachList":[]}

如果直接将json字符串写在java代码里,处理json字符串中的双引号非常麻烦。这种先加密,后解密的方法巧妙的避开了这种困难。

在java代码中显示json字符串(怎么避免json字符串中双引号在java代码中显示)的更多相关文章

  1. JSON 之 SuperObject(7): 可以省略的双引号

    在 JSON 中, 字符串应该在双引号中; 从上个例子才发现: 原来这个双引号可以省略, 有空格都行 当然只是在程序代码中可以省略, 对象会自动识别添加的. 即如此, 下面写法都可以: uses Su ...

  2. 为什么 JSON 接口的数据都要加双引号!!!不能用单引号

    原因是:Javascript 在很多时候会把 JSON 对象里面没有双引号包围的值,当做数值处理.比如: {"a":987654321} 这个 JSON 里头的变量 a,会被当做一 ...

  3. js中字符串的replace方法区分单双引号

    今天遇到一问题,js文件中调用字符串的replace方法,不起作用. 后来排查可能觉得replace("<option  value='1'>admin</option&g ...

  4. PHP 单引号与双引号的区别 SQL中的使用

    php单引号与双引号用法:引号嵌套方法 1.双引号内不能直接就再嵌套双引号 2.双引号与单引号互相嵌套使用 如: 双引号内直接嵌套单引号 echo "<script language= ...

  5. 为什么建议php字符串使用单引号而不是双引号

    不少php提升效率的tip,都有提到字符串使用单引号,这是为什么呢? 因为在单引号中,php直接认为它里头包含的就是个字符串.而双引号时,php会检测里头是否包含变量.这样如果是纯粹的字符串的话,双引 ...

  6. js错误: Unexpected number in JSON at position 2792 value里面有双引号怎么解决

    源头  出现这个报错提示,大家从错误就可以看的出来,这就是json的错误,一般来说都是json格式出现了错误,本人遇到比较多的情况就是json字符串里面出现了一些会影响json格式的符号,这次出现这个 ...

  7. PHP字符串定义方式和单引号双引号的区别

    $str=<<<任意标记 ......................... .............................. 任何标记; 单引号和双引号的区别? ''号 ...

  8. c++中对于json的key不带双引号的问题修复

    在引用了第三方数据时,数据源通过转义,将json的key上双引号给去掉了. 在PHP开发时,可以通过正则表达式替换方式来补充丢失的双引号,处理代码如下 function ex_json_decode( ...

  9. js json简介(json的本质也是字符串)(用于服务器和客户端通信)

    js json简介(json的本质也是字符串)(用于服务器和客户端通信) 一.总结 1.json的语法和js的语法非常像,只是json的键和值都是双引号,因为json的本质也是字符串 2.json是一 ...

随机推荐

  1. Windows下Apache部署Django过程记录

    Win7/Apache/Python2.7/Django1.9部署Web   环境: Windows7 Apache httpd-2.4.16-win64-VC14 Python2.7.11 Djan ...

  2. twisted(1)--何为异步

    早就想写一篇文章,整体介绍python的2个异步库,twisted和tornado.我们在开发python的tcpserver时候,通常只会用3个库,twisted.tornado和gevent,其中 ...

  3. 实验四:使用库函数API和C代码中嵌入汇编代码两种方式使用同一个系统调用

    原创作品转载请注明出处<Linux内核分析>MOOC课程http://mooc.study.163.com/course/USTC-1000029000 如果我写的不好或者有误的地方请留言 ...

  4. Scut 进阶:Schema 自动检测

    Scut 在启动时有一个自动根据代码中数据类型检查数据库字段的功能,要如何使用呢? 脚本引擎动态加载 ModelAssembly: ScriptEngine.cs - InitScriptRuntim ...

  5. Android Service之LOCATION_SERVICE

    Android提供了GPS功能 LocationManager obj = (LocationManager)getSystemService(Context.LOCATION_SERVICE) Pe ...

  6. ROHS無鉛問題解答!ROHS IPC SGS

    無鉛smt(smd)問題1. 問Maxim關于無鉛的定義是什么?答無鉛表示在封裝或產品制造中不含鉛(化學符號為Pb).IC封裝中,Pb在外部引腳拋光或電鍍中很常見.對于晶片級封裝(UCSP和倒裝芯片) ...

  7. android手机游戏开发Cocos2d-x开发分享

    我想现在应该没有人没有玩过手机游戏了吧,当然所有人都玩过,但不是所有人都知道怎么去开发手机游戏,因为许多人都感觉做开发是一件很困难的事儿,身边的朋友也对此感觉难度很大.但是,现在我可以告诉你,手机游戏 ...

  8. 【HDOJ】4325 Flowers

    树状数组+离散化的题目,一直在思考为什么结果不一样,后来才发现花开了就是开了不会再谢了. /* 4325 */ #include <iostream> #include <cstdi ...

  9. OpenGl学习总结

    http://wenku.baidu.com/view/5305fe4f866fb84ae45c8dcd.html

  10. 最小费用最大流MCMF 最小增广

    没有写单纯性的...应该不会有卡最小增广的出题人吧...(雾) struct MCMF{ struct tedge{int x,y,cap,flow,w,next;}adj[maxm];int ms, ...