使用json_decode无法解析json

json 2017-07-28

在接入合作方接口时,遇到一个json无法解析出来代码如下:

  

<?php
        $res='{"resultcode":007,"resMsg":"!&!lB5:aHb-\/5hb\\Frx;%\/&>:]u&;=>foFBW>&!\"2&()o\\MN$i&J\'w9@"}';// 模拟合作方穿过的json数据 
        $date = json_decode($res,true);
        var_dump($date);
?>

  由于无法解析json数据导致接口无法接入,到网上查了一些资料,都是说一些php配置无效,使用单引号,没有转义之类的,后来仔细检测,发现我这边都不存在这样的问题,最后找出了真正原因,原来是因为resultcode后面的参数导致,json_decode在解析json时会检测json中的类型,由于resultcode后面的参数没有加双号,json_decode会按int类型检测,但是以0开头又不属于int类型,所以会传回一个null,导致我这边无法获取到json数据。

  正确的形式,应该如下:

  

<?php
        $res='{"resultcode":007,"resMsg":"!&!lB5:aHb-\/5hb\\Frx;%\/&>:]u&;=>foFBW>&!\"2&()o\\MN$i&J\'w9@"}';// 模拟合作方穿过的json数据 
        $date = json_decode($res,true);
        var_dump($date);
?>

总的来说是合作方那边回传的json问题,这个问题在别的语言解析时也可能会遇到,今天贴出来,希望能帮助大家。


本文由 admin 创作,采用 知识共享署名 3.0,可自由转载、引用,但需署名作者且注明文章出处。

2826 条评论

  1. dnldveyysn
    dnldveyysn

    使用json_decode无法解析json - 青花瓷
    adnldveyysn
    dnldveyysn http://www.g7ncs91em1re9eay3a6r26w260b805j4s.org/
    [url=http://www.g7ncs91em1re9eay3a6r26w260b805j4s.org/]udnldveyysn[/url]

  2. fijnezozyd
    fijnezozyd

    使用json_decode无法解析json - 青花瓷
    fijnezozyd http://www.gyw85gkkho3b874pos7jb20829066jl0s.org/
    afijnezozyd
    [url=http://www.gyw85gkkho3b874pos7jb20829066jl0s.org/]ufijnezozyd[/url]

    1. Air Jordan 12 Gym Red
      Air Jordan 12 Gym Red

      Yeezy Shoes http://www.yeezy.com.co/
      Yeezys http://www.yeezys.us.com/
      Yeezy Shoes http://www.yeezysupply.us.com/
      Yeezy Boost 350 http://www.yeezy-shoes.us.com/
      Yeezy Boost http://www.yeezy-boost350.com/
      Yeezy Boost http://www.yeezyboost350.us.com/
      Yeezy Blue Tint http://www.yeezybluetint.com/
      Yeezy 500 http://www.yeezy500utilityblack.com/
      Yeezy 500 http://www.yeezy500utilityblack.us/
      Nike Air VaporMax http://www.vapor-max.org.uk/
      Salomon http://www.salomon-shoes.org.uk/
      Salomon http://www.salomons.me.uk/
      Salomon Shoes http://www.salomonspeedcross4.org.uk/
      Off White Jordan http://www.offwhitejordan1.com/
      Nike VaporMax http://www.nikevapormax.org.uk/
      React Element 87 http://www.nikereactelement87.us.com/
      Nike Element 87 http://www.nikereactelement87.us/
      Nike Vapormax Plus http://www.nikeplus.us/
      Nike Outlet Online http://www.nike--outlet.us/
      Nike Outlet Store Online Shopping http://www.nikeoutletstoreonlineshopping.us/
      Nike Outlet http://www.nikeoutletonlineshopping.us/
      Cheap Nike NBA Jerseys http://www.nikenbajerseys.us/
      Air Max Nike http://www.nikeairmax.us/
      Nike Air Max 2017 http://www.max2017.us/
      Jordan Shoes 2018 http://www.jordan-com.com/
      Jordan 11 Concord http://www.jordan11-concord.com/
      Cheap Yeezy Boost http://www.cs7boots1.com/
      Wholesale Cheap NBA Jerseys http://www.cheapnba-jerseys.us/
      Birkenstock UK http://www.birkenstocksandalsuk.me.uk/
      Basketball Jersey http://www.basketball-jersey.us/
      Balenciaga http://www.balenciaga.me.uk/
      Balenciaga UK http://www.balenciagauk.org.uk/
      Balenciaga UK http://www.balenciagatriples.org.uk/
      Balenciaga UK http://www.birkenstocks.me.uk/
      Balenciaga Trainers http://www.balenciagatrainers.org.uk/
      Air Max 270 http://www.airmax270.org.uk/
      Adidas Yeezys http://www.adidasyeezyshoes.org.uk/
      Adidas Yeezy http://www.adidasyeezyshoes.org.uk/

      1. lsanielpdutpw
        lsanielpdutpw

        yststlkvllcd canadian pharmacy cialis 20mg buying viagra online canadian pharmacy+cialis prescription pfizer viagra from canada
        viagra best price

    2. rxanielhyigsj
      rxanielhyigsj

      ebtddhkzbmvq canadian pharmacy tadalafil [url=http://northwestpharmacyph.com/]viagra professional[/url] best price cialis canadian pharmacy discount cialis
      womens viagra

  3. mljfkyntv
    mljfkyntv

    使用json_decode无法解析json - 青花瓷
    amljfkyntv
    [url=http://www.go4uf78cz9j3a686oud6p92n1zk0932ls.org/]umljfkyntv[/url]
    mljfkyntv http://www.go4uf78cz9j3a686oud6p92n1zk0932ls.org/

    1. Nike Outlet satore
      Nike Outlet satore

      Jordan 12 Gym Red http://www.jordan12gymred.us.com/
      nike factory outlet http://www.nikefactoryoutletstoreonline.com/
      Nike Outlet satore http://www.nikefactoryoutletstoreonline.us/
      Nike Outlet http://www.nikestores.us.com/
      jordan 33 http://www.jordan33.us/
      cheapjerseysfromchina http://www.cheapjerseysfromchina.us/
      custom nfl jerseys http://www.customnfljerseys.us/
      jordan 11 concord 2018 http://www.jordan11concord.us.com/
      Jordan 12 Gym Red 2018 http://www.jordan12gymred.us/
      Jordan 12 Gym Red http://www.redjordan12.us/
      Yeezy http://www.yeezy.com.co/
      Yeezy Shoes http://www.yeezys.us.com/

    2. air jordan 33
      air jordan 33

      Jordan 12 Gym Red 2018 http://www.jordan12gymred.us.com/
      nike factory outlet http://www.nikefactoryoutletstoreonline.com/
      Nike Outlet satore http://www.nikefactoryoutletstoreonline.us/
      Nike Outlet satore http://www.nikestores.us.com/
      jordan 33 http://www.jordan33.us/
      cheapjerseysfromchina http://www.cheapjerseysfromchina.us/
      cheap custom nfl jerseys http://www.customnfljerseys.us/
      air jordan 11 concord http://www.jordan11concord.us.com/
      Jordan 12 Gym Red 2018 http://www.jordan12gymred.us/
      Jordan 12 Gym Red 2018 http://www.redjordan12.us/
      Yeezys http://www.yeezy.com.co/
      Yeezy http://www.yeezys.us.com/
      Yeezy Shoes http://www.yeezysupply.us.com/
      Yeezy Boost 350 http://www.yeezy-shoes.us.com/
      Yeezy Boost http://www.yeezy-boost350.com/
      Yeezy Boost 350 http://www.yeezyboost350.us.com/
      Yeezy Boost 350 V2 Blue Tint http://www.yeezybluetint.com/
      Yeezy 500 Utility Black http://www.yeezy500utilityblack.com/
      Adidas Yeezy 500 http://www.yeezy500utilityblack.us/
      Nike Air VaporMax http://www.vapor-max.org.uk/
      Salomon http://www.salomon-shoes.org.uk/
      Salomon http://www.salomons.me.uk/
      Salomon Shoes http://www.salomonspeedcross4.org.uk/
      Off White Jordan 1 http://www.offwhitejordan1.com/
      Nike VaporMax http://www.nikevapormax.org.uk/
      Nike React Element 87 http://www.nikereactelement87.us.com/
      Nike React Element 87 http://www.nikereactelement87.us/
      Nike Plus http://www.nikeplus.us/
      Nike Outlet Online http://www.nike--outlet.us/
      Nike Outlet http://www.nikeoutletstoreonlineshopping.us/
      Nike Outlet http://www.nikeoutletonlineshopping.us/
      Cheap Nike NBA Jerseys http://www.nikenbajerseys.us/
      Nike Air Max http://www.nikeairmax.us/
      Air Max 2017 http://www.max2017.us/
      Jordan Shoes http://www.jordan-com.com/
      Jordan 11 Concord http://www.jordan11-concord.com/
      Kanye West Yeezys Boost Shoes http://www.cs7boots1.com/
      Cheap NBA Jerseys http://www.cheapnba-jerseys.us/
      Birkenstock UK http://www.birkenstocksandalsuk.me.uk/
      Basketball Jersey http://www.basketball-jersey.us/
      Balenciaga UK http://www.balenciaga.me.uk/
      Balenciaga http://www.balenciagauk.org.uk/
      Balenciaga http://www.balenciagatriples.org.uk/
      Balenciaga http://www.birkenstocks.me.uk/
      Balenciaga UK http://www.balenciagatrainers.org.uk/
      Air Max 270 http://www.airmax270.org.uk/
      Yeezy Shoes http://www.adidasyeezyshoes.org.uk/
      Adidas Yeezy http://www.adidasyeezyshoes.org.uk/

      1. ArtemevaYaromira89scied
        ArtemevaYaromira89scied

        at is site

        c471 is acquisto online

    3. Yeezy Boost 350
      Yeezy Boost 350

      Jordan 12 Gym Red http://www.jordan12gymred.us.com/
      nike factory outlet store online http://www.nikefactoryoutletstoreonline.com/
      nike factory outlet store online http://www.nikefactoryoutletstoreonline.us/
      Nike Outlet http://www.nikestores.us.com/
      jordan 33 http://www.jordan33.us/
      cheapjerseysfromchina http://www.cheapjerseysfromchina.us/
      nfl jerseys http://www.customnfljerseys.us/
      air jordan 11 concord http://www.jordan11concord.us.com/
      Jordan 12 Gym Red 2018 http://www.jordan12gymred.us/
      Jordan 12 Gym Red 2018 http://www.redjordan12.us/
      Yeezy Shoes http://www.yeezy.com.co/
      Yeezys http://www.yeezys.us.com/
      Yeezy Shoes http://www.yeezysupply.us.com/
      Yeezy Boost 350 http://www.yeezy-shoes.us.com/
      Yeezy Boost http://www.yeezy-boost350.com/
      Yeezy Boost 350 V2 http://www.yeezyboost350.us.com/
      Yeezy Boost 350 V2 Blue Tint http://www.yeezybluetint.com/
      Yeezy 500 Utility Black http://www.yeezy500utilityblack.com/
      Yeezy 500 http://www.yeezy500utilityblack.us/
      Vapor Max http://www.vapor-max.org.uk/
      Salomon Shoes http://www.salomon-shoes.org.uk/
      Salomon Shoes http://www.salomons.me.uk/
      Salomon Shoes http://www.salomonspeedcross4.org.uk/
      Off White Jordan http://www.offwhitejordan1.com/
      Vapor Max http://www.nikevapormax.org.uk/
      Nike React Element 87 http://www.nikereactelement87.us.com/
      Nike React Element 87 http://www.nikereactelement87.us/
      Nike Plus http://www.nikeplus.us/
      Nike Outlet Online http://www.nike--outlet.us/
      Nike Outlet Store http://www.nikeoutletstoreonlineshopping.us/
      Nike Outlet Store http://www.nikeoutletonlineshopping.us/
      Cheap Nike NBA Jerseys http://www.nikenbajerseys.us/
      Air Max Nike http://www.nikeairmax.us/
      Air Max 2017 http://www.max2017.us/
      Jordan Shoes 2018 http://www.jordan-com.com/
      Jordan 11 Concord http://www.jordan11-concord.com/
      Cheap Yeezy Boost http://www.cs7boots1.com/
      Wholesale Cheap NBA Jerseys http://www.cheapnba-jerseys.us/
      Birkenstock Sandals UK http://www.birkenstocksandalsuk.me.uk/
      NBA Jerseys http://www.basketball-jersey.us/
      Balenciaga http://www.balenciaga.me.uk/
      Balenciaga UK http://www.balenciagauk.org.uk/
      Balenciaga UK http://www.balenciagatriples.org.uk/
      Balenciaga UK http://www.birkenstocks.me.uk/
      Balenciaga http://www.balenciagatrainers.org.uk/
      Nike Air Max http://www.airmax270.org.uk/
      Yeezy Shoes http://www.adidasyeezyshoes.org.uk/
      Adidas Yeezy Shoes http://www.adidasyeezyshoes.org.uk/

      1. ArtemevaYaromira89scied
        ArtemevaYaromira89scied

        is daily bestellen

        c471 farmacia de is nyc

        1. Szlorsof
          Szlorsof

          It is wholly fabulous that today I was looking inasmuch as something to submit me a jerk of happiness. The grotesque thing is that I found it in the senior place. I was struggling to make money to get my hire paid, and I could not idol entirely what to do. Some friends gave me a few special options, but I till was not dedicated to those solutions. However, I finally figured out that I right-minded needed to take a look at this website to resolve all my problems: online payday loan

      2. ArtemevaYaromira89scied
        ArtemevaYaromira89scied

        enter site how much is is

        c471 order brand is without rx

        1. ghanielivmhhd
          ghanielivmhhd

          mdkpouonhaaf tadalafil canadian canadian drugs new viagra branded cialis from canada
          pharmacy rx one

    4. MikkerBug
      MikkerBug

      You can hear about our amazing page and get to know how spectacular you can be: onlineblackjack.us.org

  4. jgtqobiif
    jgtqobiif

    使用json_decode无法解析json - 青花瓷
    jgtqobiif http://www.gw37un1cl7q3lw1ue415k42b829g8w5ds.org/
    ajgtqobiif
    [url=http://www.gw37un1cl7q3lw1ue415k42b829g8w5ds.org/]ujgtqobiif[/url]

    1. KudryavcevVilorg97scied
      KudryavcevVilorg97scied

      is is hamburg

      f612 genetic is

    2. nvanieldtwtki
      nvanieldtwtki

      ucdyhmodibwl female viagra cream buy viagra generic buy viagra online uk cialisthepharmacy
      best online pharmacy for cialis

    3. mranielggpjwy
      mranielggpjwy

      muaiewjwescp viagra for men canadian pharmacy tadalafil cialis-canadian pharmacy canada price for cialis
      viagra soft pills

  5. owthlqqim
    owthlqqim

    使用json_decode无法解析json - 青花瓷
    [url=http://www.g0c7806a7c59oqr9885auqk9q0hw99gds.org/]uowthlqqim[/url]
    owthlqqim http://www.g0c7806a7c59oqr9885auqk9q0hw99gds.org/
    aowthlqqim

    1. Howardadete
      Howardadete

      canadianpharmacya24hr.com

      1. emanielirxotc
        emanielirxotc

        ndsfpwnmpebs cikalis online viagra sales ceallas viagra canada
        generic viagra reviews

    2. hwanielfrdqyz
      hwanielfrdqyz

      igavsejjrcdr viagra natural lowest price viagra cialis daily canada canadian pharcharmy online viagra
      cialis cheap

    3. yuanielbllull
      yuanielbllull

      oimqkanrjfgu buy cialis online canada pharmacy no rx canada pharmacy viagra natural viagra without a doctor prescription canadian drugs
      lowest price on cialis

    4. dbggovacE
      dbggovacE

      online pharmacy india http://onlinepharmacyzefb.com/ - mexican pharmacy online canadian online pharmacy ed online canadian pharmacy http://onlinepharmacyzefb.com/

    5. bbuiAtopy
      bbuiAtopy

      cheap viagra online canadian pharmacy http://pharmacy-onlineasxs.com/ - non prescription online pharmacy reviews click this link costco online pharmacy online pharmacy canada http://pharmacy-onlineasxs.com/

    6. vsxxRuime
      vsxxRuime

      i thought about this http://canadianonlinepharmacyfdth.com/ - generic viagra online canadian pharmacy viagra canadian online pharmacy reviews brand viagra online canadian pharmacy http://canadianonlinepharmacyfdth.com/

    7. zzwsenhah
      zzwsenhah

      canada online pharmacy http://pharmacyonlinevfr.com/ - cialis online pharmacy viagra online read viagra online http://pharmacyonlinevfr.com/

    8. bthdDeala
      bthdDeala

      canada pharmacy online reviews http://canadapharmacyonlinestbh.com/ - canada pharmacy checker northwest pharmacy canada canada pharmacy review п»їstuff http://canadapharmacyonlinestbh.com/

    9. vfsfenhah
      vfsfenhah

      best canadian online pharmacy http://canadian-pharmacyyhzg.com/ - cheap viagra online canadian pharmacy cheap viagra online canadian pharmacy cialis viagra http://canadian-pharmacyyhzg.com/

    10. hvsjplani
      hvsjplani

      canadian online pharmacy http://canadian-pharmacyonlineolys.com/ - generic viagra canadian pharmacy online viagra legit canadian pharmacy online http://canadian-pharmacyonlineolys.com/

    11. bfxSmeda
      bfxSmeda

      global pharmacy canada http://canadapharmacyliiu.com/ - canada pharmacy not requiring prescription canada drugs pharmacy viagra online canada drug pharmacy http://canadapharmacyliiu.com/

    12. jfhhPoego
      jfhhPoego

      best online canadian pharmacy review http://canadianonline-pharmacydazc.com/ - online canadian pharmacy reviews canadian pharmacy online canadian online pharmacy no prescription best canadian online pharmacy http://canadianonline-pharmacydazc.com/

    13. iyvvDeala
      iyvvDeala

      best online pharmacy http://canadianpharmacyonlinejycx.com/ - canada drugs online online canadian pharmacy canada pharmacy online canadian pharmacies http://canadianpharmacyonlinejycx.com/

    14. hrffenhah
      hrffenhah

      canadian pharmacy viagra http://canadianonlinepharmacystbm.com/ - п»їcanadian pharmacy online pharmacy best canadian online pharmacy canada pharmacy online http://canadianonlinepharmacystbm.com/

    15. grffhuppy
      grffhuppy

      best canadian online pharmacy http://canadadrugsonlinewxwe.com/ - best canadian online pharmacy online pharmacy online canadian pharmacy canadian pharmacy http://canadadrugsonlinewxwe.com/

    16. bbxeovacE
      bbxeovacE

      buy viagra