Add helper functions for json files

This commit is contained in:
eraseyourknees
2022-09-13 23:40:03 +02:00
parent 54b605c1d4
commit 8894bd9cc0
2 changed files with 14 additions and 1 deletions

View File

@ -166,3 +166,16 @@ function uupApiFixDownloadLink($link) {
$link
);
}
function uupApiReadJson($path) {
$data = @file_get_contents($path);
if(empty($data))
return false;
return json_decode($data, true);
}
function uupApiWriteJson($path, $data) {
return file_put_contents($path, json_encode($data)."\n");
}