整了还久还是没找到方法,请教各位大神了
List info = service.selInfo(string);
这样的list怎么转换json{}
这个又是什么错误呢
严重: Servlet.service() for servlet [dispatcherServlet] in context with path [/TextGrad] threw exception [Handler processing failed; nested exception is java.lang.AbstractMethodError: Method org/apache/commons/dbcp/DelegatingResultSet.getNString(Ljava/lang/String;)Ljava/lang/String; is abstract] with root cause
java.lang.AbstractMethodError: Method org/apache/commons/dbcp/DelegatingResultSet.getNString(Ljava/lang/String;)Ljava/lang/String; is abstract
BillingInfo是怎么定义的?你需要什么格式的json?大不了自己拼接下
String json = "";
bool b = true;
for (BillingInfo b : info)
{
if (!b) //不是第一行 json += 分割符; else b = false;
json += b.xxx; //在这里拼接每一行
}
如果你的list中是对象,那么json格式就是[{},{},...]形式的,每个{}中的key是对象属性名,value是属性对应的值;如果你的list中只是字面值,那么是不存在转json格式的说法,不满足k-v条件。
list中如果是对象,转JSONArray格式就是 [{},{},{}]这种格式,你的意思是不是list中的对象只有一个属性,把这一个属性放到JSONObject中?