Question

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?

Was it helpful?

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.

OTHER TIPS

You're apparently using Xdebug, a PHP debugging extension that (among other features) overloads the native var_dump() function with its own fancy version. You can tweak its settings or simply disable it by setting the xdebug.overload_var_dump directive to false.

In php.ini:

xdebug.overload_var_dump=0

In regular PHP code:

<?php
ini_set('xdebug.overload_var_dump', 0);

Why don't you just dump the JSON? JSON is more readable and if you echo it, it won't be cut off. It won't be formatted nicely, but you can easily copy/paste it into an editor that will format it nicely (many IDE's can do this). Firefox's Scratchpad development tool can do it too.

Add this code at the end line of your php.ini, if you are using xampp C:\xampp\php\ php.ini

; with sane limits
xdebug.var_display_max_depth = 10
xdebug.var_display_max_children = 256
xdebug.var_display_max_data = 1024 

; with no limits
; (maximum nesting is 1023)
xdebug.var_display_max_depth = -1 
xdebug.var_display_max_children = -1
xdebug.var_display_max_data = -1 

Its work 100% for me

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top