1
0
Fork 0
mirror of https://github.com/ethauvin/JSON-java.git synced 2025-06-17 07:50:52 -07:00
This commit is contained in:
Douglas Crockford 2012-11-13 14:26:15 -08:00
parent 71c7539dd3
commit 216a4299f3

View file

@ -77,7 +77,7 @@ import java.util.Map;
* </ul> * </ul>
* *
* @author JSON.org * @author JSON.org
* @version 2012-04-20 * @version 2012-11-13
*/ */
public class JSONArray { public class JSONArray {
@ -556,8 +556,8 @@ public class JSONArray {
public String optString(int index, String defaultValue) { public String optString(int index, String defaultValue) {
Object object = this.opt(index); Object object = this.opt(index);
return JSONObject.NULL.equals(object) return JSONObject.NULL.equals(object)
? defaultValue : object ? defaultValue
.toString(); : object.toString();
} }
@ -816,7 +816,7 @@ public class JSONArray {
*/ */
public String toString() { public String toString() {
try { try {
return '[' + this.join(",") + ']'; return this.toString(0);
} catch (Exception e) { } catch (Exception e) {
return null; return null;
} }