scripts

Merge-Json.ps1

SYNOPSIS

Create a new JSON string by recursively combining the properties of JSON strings.

SYNTAX

Merge-Json.ps1 [-InputObject] <String[]> [-Compress] [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

EXAMPLES

EXAMPLE 1

'{"a":1,"b":{"u":3},"c":{"v":5}}','{"a":{"w":8},"b":2,"c":{"x":6}}' |Merge-Json.ps1

{ “a”: { “w”: 8 }, “b”: 2, “c”: { “v”: 5, “x”: 6 } }

PARAMETERS

-InputObject

JSON string to combine. Descendant properties are recursively merged. Primitive values are overwritten by any matching ones in the new JSON string.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-Compress

Omits white space and indented formatting in the output string.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.String of JSON to combine.

OUTPUTS

System.String of JSON combining the inputs.

NOTES

Merge-PSObject.ps1

ConvertFrom-Json

ConvertTo-Json