Search code examples
phpjsonvar-dump

var_dump on a json_decode variable PHP


quick question, im doing a var_dump on a json_decode variable in php like this:

var_dump(json_decode($some_Variable, true));

And, since $some_Variable is quite a long json string, it shows up like this in my browser:

array (size=10)
      0 => 
        array (size=14)
          'gameId' => int 1290161341
          'invalid' => boolean false
          'gameMode' => string 'CLASSIC' (length=7)
          'gameType' => string 'MATCHED_GAME' (length=12)
          'subType' => string 'RANKED_SOLO_5x5' (length=15)
          'mapId' => int 1
          'teamId' => int 200
          'championId' => int 55
          'spell1' => int 4
          'spell2' => int 14
          'level' => int 30
          'createDate' => float 1390601626963
          'fellowPlayers' => 
            array (size=9)
              ...
          'statistics' => 
            array (size=44)
              ...
      1 => 
        array (size=14)
          'gameId' => int 1291665162
          'invalid' => boolean false
          'gameMode' => string 'CLASSIC' (length=7)
          'gameType' => string 'MATCHED_GAME' (length=12)
          'subType' => string 'RANKED_SOLO_5x5' (length=15)
          'mapId' => int 1
          'teamId' => int 200
          'championId' => int 236
          'spell1' => int 4
          'spell2' => int 21
          'level' => int 30
          'createDate' => float 1390674755052
          'fellowPlayers' => 
            array (size=9)
              ...
          'statistics' => 
            array (size=41)
              ...

(Yes its league of legends, im using Riot API (http://developer.riotgames.com/) to write a small application). As you can see, for instance the index 'fellowPlayers' doesnt show me the actual values in it, it just shows "..." and same for statistics, how can i do so it shows the all thing in every index?


Solution

  • Since json_decode returns an array, try

    $arJson = json_decode( $strJson, true );
    var_dump( $arJson[ 0 ] );
    

    Since you are printing each element, there is chance that the result may not be obfuscated.