色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

java怎么樣將字符串轉(zhuǎn)換成json數(shù)組對(duì)象

java怎么樣將字符串轉(zhuǎn)換成json數(shù)組對(duì)象?

1、需要json的相關(guān)jar包

2、設(shè)置json格式字符串:

String str="{\"student\":[{\"name\":\"leilei\",\"age\":23},{\"name\":\"leilei02\",\"age\":23}]}";

3、建立相應(yīng)的類:

public class StudentList {

List<Student> student;

public List<Student> getStudent() {

return student;

}

public void setStudent(List<Student> student) {

this.student = student;

}

}

public class Student {

private String name;

private int age;

//private StudentClass studentClass;

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public int getAge() {

return age;

}

public void setAge(int age) {

this.age = age;

}

}

4、測(cè)試程序

import java.util.List;

import org.codehaus.jackson.map.ObjectMapper;

java數(shù)組轉(zhuǎn)json字符串,java怎么樣將字符串轉(zhuǎn)換成json數(shù)組對(duì)象