Add jsonPrettyPrint for formatted JSON output

Can be used for any debug output when needed
This commit is contained in:
Clemens Schwaighofer
2025-06-04 15:09:20 +09:00
parent d4db235e5b
commit a501fa25de
2 changed files with 19 additions and 0 deletions

View File

@@ -67,6 +67,8 @@ print "J/S::E-JSON ERROR: " . $json_class::jsonGetLastError() . ": " . $json_cla
$array = ['foo' => 'bar'];
$output = Json::jsonConvertArrayTo($array);
print "S::JSON: " . DgS::printAr($array) . " => " . $output . "<br>";
$array = ['foo' => 'bar', 'sub' => ['other' => 'this', 'foo' => 'bar', 'set' => [12, 34, true]]];
print "Pretty: <pre>" . Json::jsonPrettyPrint($array) . "</pre><br>";
print "</body></html>";