public final IJson.Result fromJSON(JSONObject json, int version) {
		try {
			version = json.getInt("version");
			if(version > JSON_VERSION)
				return IJson.Result.OUTDATED_APP;

			groups = new ArrayList<PrivilegeGroup>();
			JSONArray jsonGroups = json.optJSONArray("groups");
			if(jsonGroups != null) {
				int len = jsonGroups.length();
				for(int a=0; a<len; a++) {
					try {
						groups.add(new PrivilegeGroup(jsonGroups.getJSONObject(a), version));
					}
					catch(Exception e) {
						onError(ERROR_JSON_INVALID_GROUP);
					}
				}
			}
			
			users = new ArrayList<User>();
			JSONArray jsonUsers = json.optJSONArray("users");
			if(jsonUsers != null) {
				int len = jsonUsers.length();
				for(int a=0; a<len; a++) {
					try {
						users.add(new User(jsonUsers.getJSONObject(a), version));
					}
					catch(Exception e) {
						onError(ERROR_JSON_INVALID_USER);
					}
				}
			}
			
			if(version < JSON_VERSION)
				return IJson.Result.OUTDATED_FORMAT;
			
			return IJson.Result.SUCCESS;
		}
		catch(Exception e) {
			e.printStackTrace();
			return IJson.Result.FAILURE;
		}
	}