mirror of
https://github.com/fankes/JSON-java-compat.git
synced 2025-09-06 02:35:33 +08:00
toString
This commit is contained in:
@@ -77,7 +77,7 @@ import java.util.Map;
|
||||
* </ul>
|
||||
*
|
||||
* @author JSON.org
|
||||
* @version 2012-04-20
|
||||
* @version 2012-11-13
|
||||
*/
|
||||
public class JSONArray {
|
||||
|
||||
@@ -556,8 +556,8 @@ public class JSONArray {
|
||||
public String optString(int index, String defaultValue) {
|
||||
Object object = this.opt(index);
|
||||
return JSONObject.NULL.equals(object)
|
||||
? defaultValue : object
|
||||
.toString();
|
||||
? defaultValue
|
||||
: object.toString();
|
||||
}
|
||||
|
||||
|
||||
@@ -816,7 +816,7 @@ public class JSONArray {
|
||||
*/
|
||||
public String toString() {
|
||||
try {
|
||||
return '[' + this.join(",") + ']';
|
||||
return this.toString(0);
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user