zoukankan      html  css  js  c++  java
  • php接收到的json格式不标准,某个字段中的文本包含双引号的处理

    $str = '[{"Count":"1789"},{"裁判要旨段原文":"本瑶","案件类型":"3","裁判日期":"2013-04-02","案件名称":"王新华与杭州市"规划局"一审行政判决书","文书ID":"a1b0b3ef-cd55-4bd2-a892-b86564cd3091","审判程序":"一审","案号":"(2013)杭拱行初字第5号","法院名称":"杭州市拱墅区人民法院"}]';

    $str = '[{"Count":"1789"},{"裁判要旨段原文":"本瑶","案件类型":"3","裁判日期":"2013-04-02","案件名称":"王新华与杭州市"规划局"一审行政判决书","文书ID":"a1b0b3ef-cd55-4bd2-a892-b86564cd3091","审判程序":"一审","案号":"(2013)杭拱行初字第5号","法院名称":"杭州市拱墅区人民法院"}]';
    
            $str = str_replace('{"','@@@',$str);
            $str = str_replace('":"','###',$str);
            $str = str_replace('"}','!!!',$str);
            $str = str_replace('","','%%%',$str);
    
            $str = str_replace('"','&&&',$str);
    
            $str = str_replace('@@@','{"',$str);
            $str = str_replace('###','":"',$str);
            $str = str_replace('!!!','"}',$str);
            $str = str_replace('%%%','","',$str);
    
        
            $arr = json_decode($str,true);
        
            $a = str_replace('&&&','"',$a);//取出值后再还原双引号
  • 相关阅读:
    *args和**kwargs
    事件驱动模型
    同步异步和阻塞非阻塞
    多进程和多线程
    认识tornado(五)
    认识tornado(四)
    认识tornado(三)
    [GO]使用select实现超时
    [GO]使用select实现斐波那契
    [GO]ticker的使用
  • 原文地址:https://www.cnblogs.com/blueskycc/p/5594483.html
Copyright © 2011-2022 走看看