From 7feac5cdffb434cdb9276303ad40548b8c2572cb Mon Sep 17 00:00:00 2001 From: Paul Hilchey Date: Sat, 24 May 2025 23:49:44 -0700 Subject: [PATCH 1/2] Document AsStream parameter --- .../ConvertTo-Json.md | 38 +++++++++++++++++-- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/reference/7.6/Microsoft.PowerShell.Utility/ConvertTo-Json.md b/reference/7.6/Microsoft.PowerShell.Utility/ConvertTo-Json.md index f99c04183d81..c1df86b1a323 100644 --- a/reference/7.6/Microsoft.PowerShell.Utility/ConvertTo-Json.md +++ b/reference/7.6/Microsoft.PowerShell.Utility/ConvertTo-Json.md @@ -15,9 +15,24 @@ Converts an object to a JSON-formatted string. ## SYNTAX +### Default (Default) ``` ConvertTo-Json [-InputObject] [-Depth ] [-Compress] - [-EnumsAsStrings] [-AsArray] [-EscapeHandling ] + [-EnumsAsStrings] [-EscapeHandling ] + [] +``` + +### Array +``` +ConvertTo-Json [-InputObject] -AsArray [-Depth ] [-Compress] + [-EnumsAsStrings] [-EscapeHandling ] + [] +``` + +### Stream +``` +ConvertTo-Json [-InputObject] -AsStream [-Depth ] [-Compress] + [-EnumsAsStrings] [-EscapeHandling ] [] ``` @@ -180,7 +195,23 @@ Outputs the object in array brackets, even if the input is a single object. ```yaml Type: System.Management.Automation.SwitchParameter -Parameter Sets: (All) +Parameter Sets: Array +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -AsStream + +Converts each input object to a complete JSON string. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: Stream Aliases: Required: False @@ -304,7 +335,8 @@ You can pipe any object to this cmdlet. ### System.String -This cmdlet returns a string representing the input object converted to a JSON string. +This cmdlet returns a string representing the input object(s) converted to a JSON string. +When AsStream is specified, each object is converted to a complete JSON string. ## NOTES From b94e23099cc9b92bc89333c777c5bca5c39bb13f Mon Sep 17 00:00:00 2001 From: Paul Hilchey Date: Sat, 24 May 2025 23:49:46 -0700 Subject: [PATCH 2/2] Document AsStream parameter