< Back
Write-PodeJsonResponse
Post
NAME Write-PodeJsonResponse
SYNOPSIS
Writes JSON data to the Response.
SYNTAX
Write-PodeJsonResponse -Value <Object> [-Depth <Int32>] [-StatusCode <Int32>] [<CommonParameters>]
Write-PodeJsonResponse -Path <String> [-Depth <Int32>] [-StatusCode <Int32>] [<CommonParameters>]
DESCRIPTION
Writes JSON data to the Response, setting the content type accordingly.
PARAMETERS
-Value <Object>
A String, PSObject, or HashTable value. For non-string values, they will be converted to JSON.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Path <String>
The path to a JSON file.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Depth <Int32>
The Depth to generate the JSON document - the larger this value the worse performance gets.
Required? false
Position? named
Default value 10
Accept pipeline input? false
Accept wildcard characters? false
-StatusCode <Int32>
The status code to set against the response.
Required? false
Position? named
Default value 200
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Write-PodeJsonResponse -Value '{"name": "Rick"}'
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Write-PodeJsonResponse -Value @{ Name = 'Rick' } -StatusCode 201
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Write-PodeJsonResponse -Path 'E:/Files/Names.json'
RELATED LINKS
SYNOPSIS
Writes JSON data to the Response.
SYNTAX
Write-PodeJsonResponse -Value <Object> [-Depth <Int32>] [-StatusCode <Int32>] [<CommonParameters>]
Write-PodeJsonResponse -Path <String> [-Depth <Int32>] [-StatusCode <Int32>] [<CommonParameters>]
DESCRIPTION
Writes JSON data to the Response, setting the content type accordingly.
PARAMETERS
-Value <Object>
A String, PSObject, or HashTable value. For non-string values, they will be converted to JSON.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Path <String>
The path to a JSON file.
Required? true
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Depth <Int32>
The Depth to generate the JSON document - the larger this value the worse performance gets.
Required? false
Position? named
Default value 10
Accept pipeline input? false
Accept wildcard characters? false
-StatusCode <Int32>
The status code to set against the response.
Required? false
Position? named
Default value 200
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>Write-PodeJsonResponse -Value '{"name": "Rick"}'
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Write-PodeJsonResponse -Value @{ Name = 'Rick' } -StatusCode 201
-------------------------- EXAMPLE 3 --------------------------
PS C:\\>Write-PodeJsonResponse -Path 'E:/Files/Names.json'
RELATED LINKS