mirror of
https://github.com/Ry3yr/Fake-Social-MediaWriter.git
synced 2026-08-19 17:20:03 -04:00
29 lines
804 B
PHP
29 lines
804 B
PHP
<?php
|
|
$json_data = file_get_contents('data_alcea.json');
|
|
$data = json_decode($json_data, true);
|
|
|
|
// Fix syntax errors
|
|
foreach ($data as &$item) {
|
|
// Fix errors in name field
|
|
if (isset($item['name'])) {
|
|
$item['name'] = htmlspecialchars($item['name']);
|
|
}
|
|
|
|
// Fix errors in description field
|
|
if (isset($item['description'])) {
|
|
$item['description'] = htmlspecialchars($item['description']);
|
|
}
|
|
|
|
// Fix errors in value field
|
|
if (isset($item['value'])) {
|
|
if (is_string($item['value'])) {
|
|
$item['value'] = (float) $item['value'];
|
|
}
|
|
}
|
|
}
|
|
|
|
// Fix unterminated string errors
|
|
$json_data = json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
|
file_put_contents('data_alcea.json', $json_data);
|
|
|
|
echo "JSON file has been fixed."; |