Sets a property in a JSON string or file.
Set-Json.ps1 [[-JsonPointer] <String>] [-PropertyValue] <PSObject> [-WarnOverwrite] -InputObject <String>
[-ProgressAction <ActionPreference>] [<CommonParameters>]
Set-Json.ps1 [[-JsonPointer] <String>] [-PropertyValue] <PSObject> [-WarnOverwrite] -Path <String>
[-ProgressAction <ActionPreference>] [<CommonParameters>]
'0' |Set-Json.ps1 -PropertyValue $true
true
'{}' |Set-Json.ps1 / $false
{ “”: false }
'{}' |Set-Json.ps1 /~1/~0 3.14
{ “/”: { “~”: 3.14 } }
'{a:1}' |Set-Json.ps1 /b/ZZ~1ZZ/AD~0BC 7
{ “a”: 1, “b”: { “ZZ/ZZ”: { “AD~BC”: 7 } } }
Set-Json.ps1 /powershell.codeFormatting.preset Allman -Path ./.vscode/settings.json
Sets “powershell.codeFormatting.preset”: “Allman” within the ./.vscode/settings.json file.
The full path name of the property to set, as a JSON Pointer, which separates each nested element name with a /, and literal / is escaped as ~1, and literal ~ is escaped as ~0.
Type: String
Parameter Sets: (All)
Aliases: Name
Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
The value to set the property to.
Type: PSObject
Parameter Sets: (All)
Aliases: Value
Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
Indicates that overwriting values should generate a warning.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
The JSON string to set the property in.
Type: String
Parameter Sets: InputObject
Aliases:
Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
A JSON file to update.
Type: String
Parameter Sets: Path
Aliases:
Required: True
Position: Named
Default value: None
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.
https://datatracker.ietf.org/doc/html/draft-ietf-appsawg-json-pointer-04