'I want to create an endpoint like www.example.com/.well-known/assetlinks.json on WordPress using php

I'm creating a plugin and need to create endpoint like www.example.com/.well-known/assetlinks.json. it is necessary for my plugin to work and I don't know how to create endpoint on WordPress with php. I used

add_action( 'rest_api_init', function () {
            register_rest_route( '.well-known', '/assetlinks', array(
               'methods' => 'GET',
              'callback' => 'create_assetlinks_endpoint',
           ) );
       } );

But does not work this. Can anybody help me out? This is a json data need to create api endpoint.

[
    {
      "relation": ["delegate_permission/common.handle_all_urls"],
      "target": {
        "namespace": "android_app",
     "package_name": "com.bluebricks.passwordless",
        "sha256_cert_fingerprints": [
     "E9:B5:61:8F:48:C8:62:4A:CC:70:C4:1F:B8:FA:E0:40:F0:68:68:D9:AF:F5:18:FC:6B:93:C8:53:5C:FB:0E:16"
        ]
      }
    }
  ]


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source