サンプルデータで作ったスクリプト
<?php $contents = []; for ($i = 0; $i < 365; $i++) { $date = date('Y-m-d', strtotime("-{$i} day")); $data = [ 'app' => [ "cpuAverage" => 9, "status" => 0, ], 'console' => [ "cpuAverage" => 9, "status" => 0, ], 'rds' => [ "cpuAverage" => 9, "status" => 0, ], 'web' => [ "cpuAverage" => 9, "status" => 0, ] ]; $contents["histories"][$date] = $data; } $json = json_encode($contents); file_put_contents("./status_sample_data.json", $json);