Question: I want to take only selected checkboxes. I tried this.

```
    <input class="form-check-input" type="checkbox" name="Box" value="LDL" />
    <label for="Box">LDL</label><br>

    <input class="form-check-input" type="checkbox" name="Box" value="LDL" />
    <label for="Box">LDL</label><br>`enter code here`

    <input class="form-check-input" type="checkbox" name="Box" value="HDL" />
    <label for="Box">HDL</label><br>

<div class="button-holder d-flex justify-content-center">
    <button type="submit" class="btn btn-success">Send</button>
</div>

```

This is the Action

```
    [HttpPost]
    public IActionResult SendTest(ListParams listParams)
    {

    }

```

This is the DTO

public class CheckboxParams
{
public string Box { get; set; }

```
    public bool IsChecked { get; set; }
}

public class ListParams
{
    public ListParams()
    {
        this.AllCheckedParams = new List<CheckboxParams>();
    }
    public List<CheckboxParams> AllCheckedParams { get; set; }
}

```

Answer: 
Use `Group-Object` to group the objects in the array by the value of the second column, then create one new object per group:

```
$animals = ConvertFrom-Csv @'
Species|Class
cat|mammal
dog|mammal
shark|fish
'@ -Delimiter '|'

$animals2 = $animals |Group-Object -Propert Class |ForEach-Object {
  [pscustomobject]@{
    Species = $_.Group.Species |Sort-Object -Unique   # Remove `|Sort-Object -Unique` to get the full species list (including duplicates)
    Class = $_.Name
  }
}

```

Default table formatting of `$animals2` now shows you exactly what you expect:

```
PS ~> $animals2 |Format-Table

Species    Class
-------    -----
{cat, dog} mammal
shark      fish

```
Assuming that your table of $anmimals looks like what I've defined, you can use the following:

```
$animals = '[{"name": "cat", "class": "mammal"}, {"name": "dog", "class": "mammal"}, {"name": "shark", "class": "fish"}]' | ConvertFrom-Json

# create an empty hashtable
$zoo = @{}

# loop through array of animals
foreach ($animal in $animals) {

    # look for existing class in $zoo hashtable
    if ($zoo.ContainsKey($animal.class)) {
        # check to make sure the animal name doesn't already exist
        if ($zoo[$animal.class] -notcontains $animal.name) {
            $zoo[$animal.class] += $animal.name
        }
    } else {
        # create a new class and add the name into the array
        $zoo[$animal.class] = [System.Collections.ArrayList] @()
        $zoo[$animal.class] += $animal.name
    }
}

$zoo

```