public function jsonToTable($json) { $output = null; $_g = 0; $_g1 = Reflect::fields($json); while ($_g < $_g1->length) { $name = $_g1[$_g]; ++$_g; $t = Reflect::field($json, $name); $columns = Reflect::field($t, "columns"); if ($columns === null) { continue; } $rows = Reflect::field($t, "rows"); if ($rows === null) { continue; } $output = new coopy_SimpleTable($columns->length, $rows->length); $has_hash = false; $has_hash_known = false; $_g3 = 0; $_g2 = $rows->length; while ($_g3 < $_g2) { $i = $_g3++; $row = $rows[$i]; if (!$has_hash_known) { if (Reflect::fields($row)->length === $columns->length) { $has_hash = true; } $has_hash_known = true; } if (!$has_hash) { $lst = $row; $_g5 = 0; $_g4 = $columns->length; while ($_g5 < $_g4) { $j = $_g5++; $val = $lst[$j]; $output->setCell($j, $i, coopy_Coopy::cellFor($val)); unset($val, $j); } unset($_g5, $_g4); unset($lst); } else { $_g51 = 0; $_g41 = $columns->length; while ($_g51 < $_g41) { $j1 = $_g51++; $val1 = Reflect::field($row, $columns[$j1]); $output->setCell($j1, $i, coopy_Coopy::cellFor($val1)); unset($val1, $j1); } unset($_g51, $_g41); } unset($row, $i); } unset($_g3, $_g2); unset($t, $rows, $name, $has_hash_known, $has_hash, $columns); } if ($output !== null) { $output->trimBlank(); } return $output; }