Json parse from url wildcard variable

I don’t even know where to start here.

We have a json file, parsing is not the issue. What we want to do is

http://oudomain.com/agent/name

“Name” would be the wildcard. Now if we type name it goes straight to a 404 error.
So when a person goes to any “name”, the script would check the name against the json file return the data, for that person, on that page?

How do we keep it from redirecting to the 404 and run the script to pull the variable “name” from the url and pass it through the json?

You can use a route.

c::set('routes', array(
  array(
    'pattern' => 'agent/(:any)',
    'action'  => function($name) {
      // return the data
    }
  )
));