-
-
Notifications
You must be signed in to change notification settings - Fork 46
PrettyJSON
Keramat Jokar edited this page May 13, 2024
·
2 revisions
<?php
// Example data
$data = [
"example" => "test",
"test" => [
"test" => "example"
]
];
// Load the file
require_once('application/libraries/prettyjson.php');
// Format it nicely with new lines, indentation etc.
$json = new PrettyJSON($data);
// Write to file
$file = fopen("myfile.json", "w");
fwrite($file, $json->get());
fclose($file);
Initialize the processing
Mixed $raw
Get the prettified JSON