mirror of
https://github.com/ethauvin/JSON-java.git
synced 2025-06-17 07:50:52 -07:00
toString
This commit is contained in:
parent
71c7539dd3
commit
216a4299f3
1 changed files with 4 additions and 4 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue