Code example for JSONObject

Methods: has, optJSONObject

0
    metadata.put("keyboard", keyBoardVisible);
    return node;
  } 
 
  private boolean hasKeyBoard(JSONObject node) {
    String type = node.optJSONObject("metadata").optString("type");
    if ("UIAKeyboard".equals(type)) {
      return true; 
    } else { 
      if (node.has("children")) {
        JSONArray children = node.optJSONArray("children");
        for (int i = 0; i < children.length(); i++) {
          JSONObject child = children.optJSONObject(i);
          boolean res = hasKeyBoard(child);
          if (res) {
            return res;
          } 
        } 
      } 
    } 
    return false;