How can I turn my controllers in omod to return json/xml

I want my controllers in the omod to return json, how can I best do it.

You could take a look at these examples:


Thank you @dkayiwa But when i try to access the url, it gives me this error

A user context must first be passed to setUserContext()…use Context.openSession() (and closeSession() to prevent memory leaks!) I have tried open the session by using Context.openSession(), but still throws me the same error