i use json-lib to convert a java Object to json string,now i define a
List<CustomObject> list=...
i want to convert it to json string,but i got
[{},{},{}]
the CustomObject
is defined as:
class CustomObject{
int id;
int num;
}
is there any way to get a correct string like:
[{'id':1,'num:3'},{'id':2,'num:4'}]
if i use struts2 to do it,it works.but i don`t know how it works,must i use struts2?