The Json
namespace is part of the FileManager
package.
Here you can see a list of included functions and their documentation.
function to_array(string $path): array
It returns an array from the given JSON file.
File\create('file.json', json_encode(['foo' => 'bar']));
$result = Json\to_array('file.json');
// result: ['foo' => 'bar']
function write(string $path, array $data): bool
It creates a file in the given path with a JSON encoded content of the given data.
$arr = ['foo' => 'bar'];
Json\write('file.json', $arr);
echo File\content('file.json');
Output:
{
"foo": "bar"
}