Skip to content

Commit 216a429

Browse files
toString
1 parent 71c7539 commit 216a429

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

JSONArray.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ of this software and associated documentation files (the "Software"), to deal
7777
* </ul>
7878
*
7979
* @author JSON.org
80-
* @version 2012-04-20
80+
* @version 2012-11-13
8181
*/
8282
public class JSONArray {
8383

@@ -556,8 +556,8 @@ public String optString(int index) {
556556
public String optString(int index, String defaultValue) {
557557
Object object = this.opt(index);
558558
return JSONObject.NULL.equals(object)
559-
? defaultValue : object
560-
.toString();
559+
? defaultValue
560+
: object.toString();
561561
}
562562

563563

@@ -816,7 +816,7 @@ public JSONObject toJSONObject(JSONArray names) throws JSONException {
816816
*/
817817
public String toString() {
818818
try {
819-
return '[' + this.join(",") + ']';
819+
return this.toString(0);
820820
} catch (Exception e) {
821821
return null;
822822
}

0 commit comments

Comments
 (0)