NO IMAGE

謹以此文感謝閆師兄這些日子對我的幫助,謝謝!

import java.util.ArrayList;
import java.util.List;
import com.alibaba.fastjson.JSONObject;
public class Main {
public static void main(String[] argv) throws Exception {
List<A> a = new ArrayList<A>() ;
a.add(new A("1", 1)) ;
a.add(new A("2", 2)) ;
a.add(new A("3", 3)) ;
Object o = JSONObject.toJSON(a) ;
System.out.println(o) ;
}
}
class A{
String name ;
Integer age ; 
A(String name , Integer age){
this.name = name ;
this.age = age ;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
}

已Object返回不會出現反斜槓[{“age”:1,”name”:”1″},{“age”:2,”name”:”2″},{“age”:3,”name”:”3″}]