I am trying to count the length of an array that I converted from JSON using json_decode
in php but it is not working for some reason. This is my current code. The JSON list contains an array that has 10,000 items. I am pretty sure that I am missing something. Any help will be greatly appreciated.
PHP
<?php
$fl = file_get_contents($somepath);
$text = json_decode($fl, true);
$len = count($text["alphalist"]);
echo $len;
?>
JSON
{
"alphalist": [{
"a": "alphabet1."
}, {
"b": "alphabet2."
}, {
"c": "alphabet3."
}, {
"d": "alphabet4."
}, {
"e": "alphabet5."
}
....
{
"zzzzz": "alphabet10000."
}
]
}