I have a (java.util.List) List returned to the jag. That should be printed as a json .
var storeForum = Packages.org.wso2.carbon.forum.registry.RegistryForumManager;
var forum = new storeForum();
var start = request.getParameter('start');
var count = request.getParameter('count');
var array =forum.fetchForumTopics(start,count, tenantDomainsArr, -1234, user.username);
forum.fetchForumTopics method returns
List<customOjbect>
How to print it as a json. Didn't find anything useful on net.