Create a new PSObject by recursively combining the properties of PSObjects.
Merge-PSObject.ps1 [[-ReferenceObject] <PSObject>] [-InputObject] <PSObject> [-Accumulate] [-Force]
[-ProgressAction <ActionPreference>] [<CommonParameters>]
Merge-PSObject.ps1 ([pscustomobject]@{a=1;b=2}) ([pscustomobject]@{b=0;c=3})
a b c
1 0 3
'{"a":1,"b":{"u":3},"c":{"v":5}}','{"a":{"w":8},"b":2,"c":{"x":6}}' |ConvertFrom-Json |Merge-PSObject.ps1 -Force |ConvertTo-Json
{ “a”: { “w”: 8 }, “b”: 2, “c”: { “v”: 5, “x”: 6 } }
Initial PSObject to combine.
Type: PSObject
Parameter Sets: (All)
Aliases:
Required: False
Position: 1
Default value: [pscustomobject]@{}
Accept pipeline input: False
Accept wildcard characters: False
PSObjects to combine. PSObject descendant properties are recursively merged. Primitive values are overwritten by any matching ones in the new PSObject.
Type: PSObject
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
Type: ActionPreference
Parameter Sets: (All)
Aliases: proga
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.