轻量级 Android JSONObject 转 Java Bean 工具:Android Json Parser
jopen
10年前
Android Json Parser 是轻量级 Android JSONObject 转 Java Bean 工具,也可用于使用 org.json.* 包的 Java 工程。
[ { "name": "hello", "age": 1, "address": { "address": "number 1", "postcode": 434000 }, "datas": [ { "width": 480, "length": 800, "shape": "retangle sape" }, { "width": 540, "length": 960, "shape": "cycle sape" } ] } ]
[Info [name=hello, age=1, address=Address [address=number 1, postcode=434000], datas=[Data [length=800, width=480, shape=retangle sape], Data [length=960, width=540, shape=cycle sape]]]]
public class Info implements Serializable{ private static final long serialVersionUID = -7128975465639889745L; public String name; public Integer age; public Address address; public List datas; public Info() { super(); } @Override public String toString() { return "Info [name=" + name + ", age=" + age + ", address=" + address + ", datas=" + datas + "]"; } }
public class Address implements Serializable { private static final long serialVersionUID = -5953347429635753009L; public String address; public Integer postcode; public Address() { super(); } @Override public String toString() { return "Address [address=" + address + ", postcode=" + postcode + "]"; } }
public class Data implements Serializable { private static final long serialVersionUID = -2155648856259566537L; public Integer length; public Integer width; public String shape; public Data() { super(); } @Override public String toString() { return "Data [length=" + length + ", width=" + width + ", shape=" + shape + "]"; } }