The proper REST way of doing this is to return a HTTP 404 status code.
A Person IS a resource in the context of your API, so it should be fine. REST clients and developers know how to handle HTTP errors, and the 404 error is very meaningful.
You can write in the 404 response body a reason, but I wouldn't mind that.
To expand further on the use of HTTP Status Code for REST API responses, if you were returning a set instead of a single object, for example the Employees under a specific Department, you could yield a HTTP 204 (NO CONTENT) status if the department does exist but there are no employees under it (meaning an empty set for an existing department), or a HTTP 404 (NOT FOUND) status if there is no such department. You should always document you API and the semantics of the returned status codes.
Another way of approaching this is to have a standardized JSON response which includes success/error information, together with the payload. For example, all your controller's "JSON" actions could return a class inheriting from this base classe:
public class ApiResponse {
// I use lowercase properties so that the JSON follows common JavaScript naming conventions
public bool success { get; set; }
public String errorMessage { get; set; }
public int? errorCode { get; set; }
}
And your controller method that returns the person could use something like this:
public class GetPersonResponse : ApiResponse {
public PersonModel person { get; set; }
}
In your controller you could do something like this:
public GetPersonResponse Person(string id) {
var person = FindPersonByName(id);
var response = new GetPersonResponse {
success = person != null,
person = person
}
if (person == null) {
response.errorCode = 404, // suggestion only
response.errorMessage = "Person not found"
}
return response;
}
Since JSON serializers won't serialize (by default) null properties the above code get you covered by not serializing the payload (person) when it is not found, or not serializing error information if it is.