public JSONObject usersCodeActivityToJson(List<UsersEntity> listUsers, List<UserActivitiesEntity> listUsersActivities, Date[] dateList, int pieces) {

		JSONObject jsonObject = new JSONObject();
		JSONArray jsonArrayCommiters = new JSONArray();

		Collections.sort(listUsers);

		for (UsersEntity usersEntity : listUsers) {
			JSONObject commiterObject = new JSONObject();
			commiterObject.put("id", usersEntity.getId());
			commiterObject.put("name", usersEntity.getName());
			jsonArrayCommiters.add(commiterObject);
		}
		jsonObject.put("commiters", jsonArrayCommiters);

		JSONArray jsonArrayIntervals = new JSONArray();
		for (int i = 0; i < pieces; i++) {
			Map intervalObject = new TreeMap();
			String date = new SimpleDateFormat("MMMMM d, yyyy HH:mm:ss", Locale.US).format(dateList[i]);
			intervalObject.put(0, Character.toUpperCase(date.charAt(0)) + date.substring(1));

			for (UserActivitiesEntity userActivitiesEntity : listUsersActivities) {
				if (userActivitiesEntity.getActivities() != null) {
					intervalObject.put(userActivitiesEntity.getId(), userActivitiesEntity.getActivities()[i]);
				} else {
					intervalObject.put(userActivitiesEntity.getId(), 0);
				}
			}
			jsonArrayIntervals.add(intervalObject);
		}
		jsonObject.put("intervals", jsonArrayIntervals);

		return jsonObject;
	}