Skip to content

WIP: ConvertTo-Json: add AsStream parameter #12101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 35 additions & 3 deletions reference/7.6/Microsoft.PowerShell.Utility/ConvertTo-Json.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,24 @@ Converts an object to a JSON-formatted string.

## SYNTAX

### Default (Default)
```
ConvertTo-Json [-InputObject] <Object> [-Depth <Int32>] [-Compress]
[-EnumsAsStrings] [-AsArray] [-EscapeHandling <StringEscapeHandling>]
[-EnumsAsStrings] [-EscapeHandling <StringEscapeHandling>]
[<CommonParameters>]
```

### Array
```
ConvertTo-Json [-InputObject] <Object> -AsArray [-Depth <Int32>] [-Compress]
[-EnumsAsStrings] [-EscapeHandling <StringEscapeHandling>]
[<CommonParameters>]
```

### Stream
```
ConvertTo-Json [-InputObject] <Object> -AsStream [-Depth <Int32>] [-Compress]
[-EnumsAsStrings] [-EscapeHandling <StringEscapeHandling>]
[<CommonParameters>]
```

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down