[英]How to convert arraylist of custom object in to json in javascript
I have a (java.util.List) List returned to the jag. 我有一个(java.util.List)列表返回给Jag。 That should be printed as a json .
那应该打印为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 forum.fetchForumTopics方法返回
List<customOjbect>
How to print it as a json. 如何将其打印为json。 Didn't find anything useful on net.
网上找不到任何有用的东西。
i'm not quite sure what a jag is - but you can use JSON.stringify() to convert an array of pairs or values into a JSON object 我不太确定是什么尖齿-但您可以使用JSON.stringify()将成对的数组或值转换为JSON对象
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify
JSON.stringify(array)
由于这是一个Java对象,您是否可以使用可以将相应的Object转换为JSON的Java模块尝试进行此转换?。您可能必须将该模块导入.jag(jaggery)文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.