使用下面的代码来查找密钥是否存在
JsonObject。
has("key")方法用于查找中的键JsonObject。
containerObject = new JSonObject(container);//has methodif (containerObject.has("video")) { //get Value of video String video = containerObject.optString("video");}如果您正在使用
optString("key")方法获取String值,则不必担心键中是否存在键JsonObject。



