Skip to content

Commit

Permalink
toString
Browse files Browse the repository at this point in the history
  • Loading branch information
douglascrockford committed Nov 13, 2012
1 parent 71c7539 commit 216a429
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions JSONArray.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ of this software and associated documentation files (the "Software"), to deal
* </ul>
*
* @author JSON.org
* @version 2012-04-20
* @version 2012-11-13
*/
public class JSONArray {

Expand Down Expand Up @@ -556,8 +556,8 @@ public String optString(int index) {
public String optString(int index, String defaultValue) {
Object object = this.opt(index);
return JSONObject.NULL.equals(object)
? defaultValue : object
.toString();
? defaultValue
: object.toString();
}


Expand Down Expand Up @@ -816,7 +816,7 @@ public JSONObject toJSONObject(JSONArray names) throws JSONException {
*/
public String toString() {
try {
return '[' + this.join(",") + ']';
return this.toString(0);
} catch (Exception e) {
return null;
}
Expand Down

0 comments on commit 216a429

Please sign in to comment.