public static boolean checkValidKeys(JSONObject jo,Fields fields){
  @SuppressWarnings("unchecked") Set<String> fieldSet=fields.getFields();
  Set<String> jsonKeys=getSetOfJSONKeys(jo);
  return jsonKeys.containsAll(fieldSet);
}

public static boolean checkValidKeys ( JSONObject jo , Fields fields ) { @ SuppressWarnings ( "unchecked" ) Set < String > fieldSet = fields . getFields ( ) ; Set < String > jsonKeys = getSetOfJSONKeys ( jo ) ; return jsonKeys . containsAll ( fieldSet ) ; }
this is a utility method to check that the given jsonobject has the given keys .
