关于null的消失:使用JsonObject.NULL
public static final Object NULL = new JSONObject.Null();
private static final class Null {
...
}
调用的是内部类NULL,是Object对象。
public static final Object NULL = new JSONObject.Null();
private static final class Null {
...
}
调用的是内部类NULL,是Object对象。
2016-10-20
其实不用自己定义一个nullObject,JSONObject源码中已经帮我们定义了:
/**
* JSONObject.NULL is equivalent to the value that JavaScript calls null,
* whilst Java's null is equivalent to the value that JavaScript calls
* undefined.
*/
private static final class Null {
...
}
/**
* JSONObject.NULL is equivalent to the value that JavaScript calls null,
* whilst Java's null is equivalent to the value that JavaScript calls
* undefined.
*/
private static final class Null {
...
}
2016-10-18
已采纳回答 / XhstormR
在你app的builder.gradle的dependencies{}里加 compile 'com.google.code.gson:gson:2.7'
2016-10-18
jar包用maven配置一下就有:
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.4</version>
</dependency>