Q:

Trying to add an object to an array of hashtables in powershell

If the answer is out there, I am not able to find it. I am trying to work with Json in powershell, and the target system is looking for an array of hashtables. Each hashtable has the item name as value. Here is how I am creating my array:
$json = @{
 update = @{        
  customfield_11136 = @( @{ setty = @( @{ value="testValue" })})
 }
}

The actual array is quite a bit larger, but this is the part I am working on at the moment. I am trying to add an additional value to $json.update.customfield_11136.setty.
Ultimately the output should look something like:
{
    "update": {
        "customfield_11136": [{
            "set": [{
                "value": "E0"
            }, {
                "value": "N0"
            }, {
                "value": "T0"
            }]
        }]
    }
}

But I need to be able to add the additional values after initial creation.
I have tried every combination I could think of with .add() and +=, but I am not able to get anything to work. I believe this is a punctuation issue on my part, but I am fairly new to working with hashtable arrays, and have tried everything I can think of.
Appreciate any input.

A:

Based on your example this works for me:
$json["update"]["customfield_11136"][0]["setty"] += @{"value"="E0"}

ConvertTo-Json -Depth 5 $json

