mirror of
https://github.com/ethauvin/JSON-java.git
synced 2025-06-17 07:50:52 -07:00
JSONArray.optString when NULL
This commit is contained in:
parent
ce2f5ed80a
commit
5a4fb657a8
1 changed files with 2 additions and 2 deletions
|
@ -78,7 +78,7 @@ import java.util.Map;
|
||||||
* </ul>
|
* </ul>
|
||||||
|
|
||||||
* @author JSON.org
|
* @author JSON.org
|
||||||
* @version 2011-05-04
|
* @version 2011-08-25
|
||||||
*/
|
*/
|
||||||
public class JSONArray {
|
public class JSONArray {
|
||||||
|
|
||||||
|
@ -555,7 +555,7 @@ public class JSONArray {
|
||||||
*/
|
*/
|
||||||
public String optString(int index, String defaultValue) {
|
public String optString(int index, String defaultValue) {
|
||||||
Object object = opt(index);
|
Object object = opt(index);
|
||||||
return object != null ? object.toString() : defaultValue;
|
return JSONObject.NULL.equals(object) ? object.toString() : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue