Skip to content

Import-Json

SYNOPSIS

Imports JSON data from a file.

SYNTAX

__AllParameterSets

Import-Json [-Path] <string[]> [[-Depth] <int>] [<CommonParameters>]

ALIASES

This cmdlet has the following aliases, {{Insert list of aliases}}

DESCRIPTION

Reads JSON content from one or more files and converts it to PowerShell objects. Supports pipeline input for processing multiple files.

EXAMPLES

EXAMPLE 1

Import-Json -Path 'config.json'

Imports JSON data from config.json file.

EXAMPLE 2

Import-Json -Path 'data/*.json'

Imports JSON data from all .json files in the data directory.

EXAMPLE 3

'settings.json', 'users.json' | Import-Json

Imports JSON data from multiple files via pipeline.

EXAMPLE 4

Import-Json -Path 'complex.json' -Depth 50

Imports JSON data with a custom maximum depth of 50 levels.

PARAMETERS

-Depth

The maximum depth to expand nested objects. Uses ConvertFrom-Json default if not specified.

Type: System.Int32
DefaultValue: 0
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 1
  IsRequired: false
  ValueFromPipeline: false
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

-Path

The path to the JSON file to import. Supports wildcards and multiple paths. Can be provided via pipeline.

Type: System.String[]
DefaultValue: ''
SupportsWildcards: false
Aliases:
- FullName
ParameterSets:
- Name: (All)
  Position: 0
  IsRequired: true
  ValueFromPipeline: true
  ValueFromPipelineByPropertyName: true
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

CommonParameters

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

INPUTS

System.String[]

{{ Fill in the Description }}

OUTPUTS

NOTES