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);//取出值后再还原双引号
  • 相关阅读:
    The password has to have a minimum of 6 characters, including at least 1 small letter, 1 uppercase letter and 1 number
    Angular i18n的技术分享、踩过的坑
    转: .Net 4.0 ExpandoObject 使用
    min_square
    KALMAN PYTHON
    双系统安装 win + ubuntu
    docker
    drl
    shell
    导航定位方案
  • 原文地址:https://www.cnblogs.com/blueskycc/p/5594483.html
Copyright © 2011-2022 走看看