You should simply return your object, and shouldn't be concerned about whether its XML or JSON. It is the client's responsibility to request JSON or XML from the web api.
To test this I would simply use Fiddlder and make a request to the web api by specifying request header (either json or xml).
Accept: application/xml