<?php if ($_SERVER['REQUEST_METHOD'] === 'POST') { $data = json_decode(file_get_contents('php://input'), true); $file = 'json_json.json'; if (file_exists($file)) { unlink($file); } file_put_contents($file, json_encode($data, JSON_PRETTY_PRINT)); echo json_encode(['status' => 'success']); } else { echo json_encode(['status' => 'error', 'message' => 'Invalid request method']); } ?>