how to create JSON array [] for REST response?

Just use another array() inside user array()

$response = array();

$response[] = array(
    'version' => '1.0',
    'user' => array(
        array(
            'first_name' => 'Razon',
            'last_name' => 'komar pal',
            'email' => '[email protected]',
            'id' => 10,
        )
    ),
);

return rest_ensure_response($response);

It will output like:

[
    {
        "version": "1.0",
        "user": [
            {
                "first_name": "Razon",
                "last_name": "komar pal",
                "email": "[email protected]",
                "id": 10
            }
        ]
    }
]

Hope this will work for you 🙂

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)