当前位置: 软件>java软件
android-json-parser
本文导语: 一、简介 一款轻量级 Android JSONObject 转 Java Bean 工具,也可用于使用 org.json.* 包的 Java 工程。 GitHub地址:https://github.com/panxw/android-json-parser 二、示例 输入 jsonStr: [ { "name": "hello", "age": 1, ...
一、简介
一款轻量级 Android JSONObject 转 Java Bean 工具,也可用于使用 org.json.* 包的 Java 工程。
GitHub地址:https://github.com/panxw/android-json-parser
二、示例
[
{
"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 + "]";
}
}
PS:
顺便宣传下自己的GitHub,https://github.com/panxw, 欢迎来Follow~
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。