static Entry<Map<TopicPartition, List<Integer>>, Map<TopicPartitionReplica, String>> parseExecuteAssignmentArgs(
        String reassignmentJson
    ) throws JsonProcessingException {
        Entry<List<Entry<TopicPartition, List<Integer>>>, Map<TopicPartitionReplica, String>> t0 = parsePartitionReassignmentData(reassignmentJson);

        List<Entry<TopicPartition, List<Integer>>> partitionsToBeReassigned = t0.getKey();
        Map<TopicPartitionReplica, String> replicaAssignment = t0.getValue();

        if (partitionsToBeReassigned.isEmpty())
            throw new AdminCommandFailedException("Partition reassignment list cannot be empty");
        if (partitionsToBeReassigned.stream().anyMatch(t -> t.getValue().isEmpty())) {
            throw new AdminCommandFailedException("Partition replica list cannot be empty");
        }
        Set<TopicPartition> duplicateReassignedPartitions = ToolsUtils.duplicates(partitionsToBeReassigned.stream().map(t -> t.getKey()).collect(Collectors.toList()));
        if (!duplicateReassignedPartitions.isEmpty()) {
            throw new AdminCommandFailedException(String.format(
                "Partition reassignment contains duplicate topic partitions: %s",
                duplicateReassignedPartitions.stream().map(Object::toString).collect(Collectors.joining(",")))
            );
        }
        List<Entry<TopicPartition, Set<Integer>>> duplicateEntries = partitionsToBeReassigned.stream()
            .map(t -> new SimpleImmutableEntry<>(t.getKey(), ToolsUtils.duplicates(t.getValue())))
            .filter(t -> !t.getValue().isEmpty())
            .collect(Collectors.toList());
        if (!duplicateEntries.isEmpty()) {
            String duplicatesMsg = duplicateEntries.stream().map(t ->
                String.format("%s contains multiple entries for %s",
                    t.getKey(),
                    t.getValue().stream().map(Object::toString).collect(Collectors.joining(",")))
            ).collect(Collectors.joining(". "));
            throw new AdminCommandFailedException(String.format("Partition replica lists may not contain duplicate entries: %s", duplicatesMsg));
        }
        return new SimpleImmutableEntry<>(partitionsToBeReassigned.stream().collect(Collectors.toMap(t -> t.getKey(), t -> t.getValue())), replicaAssignment);
    }
Parse the reassignment JSON string passed to the --execute command.

@param reassignmentJson  The JSON string.
@return                  A tuple of the partitions to be reassigned and the replicas
                         to be reassigned.
tools/src/main/java/org/apache/kafka/tools/reassign/ReassignPartitionsCommand.java