Skip to content

Select Json

github-actions edited this page Jun 3, 2026 · 1 revision

external help file: JSONLab-help.xml Module Name: JSONLab online version: https://www.rfc-editor.org/rfc/rfc6901 schema: 2.0.0

Select-Json

SYNOPSIS

Returns a value from a JSON string or file.

SYNTAX

InputObject

Select-Json [[-JsonPointer] <String>] [-InputObject <Object>] [-FollowReferences]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

Path

Select-Json [[-JsonPointer] <String>] -Path <String> [-FollowReferences] [-ProgressAction <ActionPreference>]
 [<CommonParameters>]

DESCRIPTION

{{ Fill in the Description }}

EXAMPLES

EXAMPLE 1

'true' |Select-Json  # default selection is entire parsed JSON document

True

EXAMPLE 2

'{"":3.14}' |Select-Json /

3.14

EXAMPLE 3

Select-Json /powershell.codeFormatting.preset -Path ./.vscode/settings.json

Allman

EXAMPLE 4

'{"a":1, "b": {"ZZ/ZZ": {"AD~BC": 7}}}' |Select-Json /b/ZZ~1ZZ

Name Value


AD~BC 7

EXAMPLE 5

'{"a":1, "b": {"ZZ/ZZ": {"AD~BC": 7}}}' |ConvertFrom-Json |Select-Json /b/ZZ~1ZZ

AD~BC

7

EXAMPLE 6

'{"a":1, "b": {"ZZ/ZZ": {"AD~BC": 7}}}' |Select-Json /b/ZZ~1ZZ |ConvertTo-Json -Compress

{"AD~BC":7}

EXAMPLE 7

'{d:{a:{b:1,c:{"$ref":"#/d/c"}},c:{d:{"$ref":"#/d/two"}},two:2}}' |Select-Json /*/a/c/* -FollowReferences

2

EXAMPLE 8

Resolve-Path $env:LOCALAPPDATA/Packages/*WindowsTerminal*/LocalState/settings.json |Get-Item |Get-Content -Raw |Select-Json /profiles/list/*/name

PowerShell Windows PowerShell Ubuntu F# Interactive F# REPL C# REPL Command Prompt Media Server (ssh) Azure Cloud Shell Developer Command Prompt for VS 2022 Developer PowerShell for VS 2022

PARAMETERS

-JsonPointer

The full path name of the property to get, as a JSON Pointer, modified to support wildcards: ~0 = ~ ~1 = / ~2 = ? ~3 = * ~4 = [

Type: String
Parameter Sets: (All)
Aliases: Name

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

-InputObject

The JSON (string or parsed object/hashtable) to get the value from.

Type: Object
Parameter Sets: InputObject
Aliases:

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

-Path

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

-FollowReferences

Indicates that references should be followed.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: FollowRefs, References

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

-ProgressAction

{{ Fill ProgressAction Description }}

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 containing JSON, or

System.Collections.Hashtable parsed from JSON, or

System.Management.Automation.PSObject parsed from JSON.

OUTPUTS

System.Boolean, System.Int64, System.Double, System.String,

System.Management.Automation.PSObject, or

System.Management.Automation.OrderedHashtable (or null) selected from JSON.

NOTES

RELATED LINKS

https://www.rfc-editor.org/rfc/rfc6901

ConvertFrom-Json