1
0
Fork 0
mirror of https://github.com/ethauvin/JSON-java.git synced 2025-06-17 07:50:52 -07:00

JSONArray.optString when NULL

This commit is contained in:
Douglas Crockford 2011-08-25 08:52:30 -07:00
parent ce2f5ed80a
commit 5a4fb657a8

View file

@ -78,7 +78,7 @@ import java.util.Map;
* </ul>
* @author JSON.org
* @version 2011-05-04
* @version 2011-08-25
*/
public class JSONArray {
@ -555,7 +555,7 @@ public class JSONArray {
*/
public String optString(int index, String defaultValue) {
Object object = opt(index);
return object != null ? object.toString() : defaultValue;
return JSONObject.NULL.equals(object) ? object.toString() : defaultValue;
}