external help file | Module Name | online version | schema |
---|---|---|---|
PSPreworkout-help.xml |
PSPreworkout |
2.0.0 |
Convert an object to JSON and write it to a file.
Out-JsonFile [-Object] <Object> [-Depth <Int32>] [[-FilePath] <String>]
[<CommonParameters>]
This function converts an object to JSON and writes the output to the specified file. By default, it saves the file with the name of the object that you provided to the function.
Out-JsonFile -Object $TestObject -FilePath $HOME
Writes $TestObject as JSON to "$HOME/TestObject.json".
Out-JsonFile -Object $TestObject -FilePath C:\Temp\report.json
Writes $TestObject as JSON to C:\Temp\report.json.
Out-JsonFile -Object $TestObject
Writes $TestObject as JSON to TestObject.json in the current working directory of the file system.
The object to convert to JSON. [ValidateScript({ if (-not [string]::IsNullOrWhiteSpace($) -and -not [string]::IsNullOrEmpty($)) { $true } })]
Type: Object
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
Depth to serialize the object into JSON. Default is 2.
Type: Int32
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: 2
Accept pipeline input: False
Accept wildcard characters: False
Full path and filename to save the JSON to. [ValidatePattern('.json$')] # Do not require a JSON extension.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -Verbose, -WarningAction, -WarningVariable, and -ProgressAction. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
Author: Sam Erde Version: 0.2.1 Modified: 2024/10/29