1
0
Fork 0
mirror of https://github.com/ethauvin/JSON-java.git synced 2025-06-17 07:50:52 -07:00

getString("null")

This commit is contained in:
Douglas Crockford 2010-12-28 06:23:18 -08:00
parent 87c4b1d59d
commit 449641a01e
2 changed files with 6 additions and 4 deletions

View file

@ -87,7 +87,7 @@ import java.util.TreeSet;
* <li>Numbers may have the <code>0x-</code> <small>(hex)</small> prefix.</li>
* </ul>
* @author JSON.org
* @version 2010-12-24
* @version 2010-12-28
*/
public class JSONObject {
@ -627,7 +627,8 @@ public class JSONObject {
* @throws JSONException if the key is not found.
*/
public String getString(String key) throws JSONException {
return get(key).toString();
Object object = get(key);
return object == NULL ? null : object.toString();
}