Send Array from JS to php file then insert it in wp database through a plugin

You have to use json_encode to return data. Also use $_POST instead of $POST.

Please try the following code for the PHP part.

function printdata() {
    $data = $_POST["req"];
    echo json_encode($data);
}

if (isset($_POST["req"])) {
    printdata();
} else {
    echo 'No Data';
}

tech