22external help file : Microsoft.PowerShell.Commands.Utility.dll-Help.xml
33Locale : en-US
44Module Name : Microsoft.PowerShell.Utility
5- ms.date : 05/16/2024
5+ ms.date : 12/04/2025
66online version : https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/convertto-json?view=powershell-7.6&WT.mc_id=ps-gethelp
77schema : 2.0.0
88title : ConvertTo-Json
@@ -11,25 +11,29 @@ title: ConvertTo-Json
1111# ConvertTo-Json
1212
1313## SYNOPSIS
14+
1415Converts an object to a JSON-formatted string.
1516
1617## SYNTAX
1718
1819### Default (Default)
20+
1921```
2022ConvertTo-Json [-InputObject] <Object> [-Depth <Int32>] [-Compress]
2123 [-EnumsAsStrings] [-EscapeHandling <StringEscapeHandling>]
2224 [<CommonParameters>]
2325```
2426
2527### Array
28+
2629```
2730ConvertTo-Json [-InputObject] <Object> -AsArray [-Depth <Int32>] [-Compress]
2831 [-EnumsAsStrings] [-EscapeHandling <StringEscapeHandling>]
2932 [<CommonParameters>]
3033```
3134
3235### Stream
36+
3337```
3438ConvertTo-Json [-InputObject] <Object> -AsStream [-Depth <Int32>] [-Compress]
3539 [-EnumsAsStrings] [-EscapeHandling <StringEscapeHandling>]
@@ -53,8 +57,8 @@ object, which is easily managed in PowerShell.
5357Many web sites use JSON instead of XML to serialize data for communication between servers and
5458web-based apps.
5559
56- As of PowerShell 7.1, ` ConvertTo-Json ` emits a warning if the depth of the input object exceeds
57- the depth specified for the command. This prevents unwanted data loss when converting objects.
60+ As of PowerShell 7.1, ` ConvertTo-Json ` emits a warning if the depth of the input object exceeds the
61+ depth specified for the command. This prevents unwanted data loss when converting objects.
5862
5963As of PowerShell 7.5-preview.3, ` ConvertTo-Json ` can serialize ** BigInteger** values as raw JSON
6064numbers.
@@ -207,7 +211,8 @@ Accept wildcard characters: False
207211
208212### -AsStream
209213
210- Converts each input object to a complete JSON string.
214+ Converts each input object to a separate, complete JSON object string, rather than combining all
215+ input objects into a single JSON array.
211216
212217` ` ` yaml
213218Type : System.Management.Automation.SwitchParameter
@@ -223,7 +228,7 @@ Accept wildcard characters: False
223228
224229### -Compress
225230
226- Omits white space and indented formatting in the output string.
231+ Omits whitespace and indented formatting in the output string.
227232
228233` ` ` yaml
229234Type : System.Management.Automation.SwitchParameter
0 commit comments