You will need to decrypt into PHP arrays before doing any data work.
Try:
$hugeArray = json_decode($huge, true); // Where variable $huge holds your JSON string. echo count($hugeArray);
If you need to count to a lower depth, you will need to iterate through the array.
For example, if you want to count the number of elements at the next level, you can do:
foreach ($hugeArray as $key => $value) { echo $key.' - '.count($value); }
However, this is not necessarily important, because it depends on what you are trying to calculate, what is your goal. This block only counts the number of 1st level layers, regardless of what actual numbers can mean.
Stegrex
source share