Skip to content

Commit 5fd7a3d

Browse files
authored
Update parameter info for Test-Json (#11292)
1 parent a38d38d commit 5fd7a3d

File tree

3 files changed

+60
-31
lines changed

3 files changed

+60
-31
lines changed

reference/7.2/Microsoft.PowerShell.Utility/Test-Json.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Utility
5-
ms.date: 03/14/2024
5+
ms.date: 07/24/2024
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/test-json?view=powershell-7.2&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
title: Test-Json
@@ -187,7 +187,7 @@ Parameter Sets: (All)
187187
Aliases:
188188

189189
Required: True
190-
Position: 1
190+
Position: 0
191191
Default value: None
192192
Accept pipeline input: True (ByValue)
193193
Accept wildcard characters: False
@@ -207,7 +207,7 @@ Parameter Sets: SchemaString
207207
Aliases:
208208
209209
Required: False
210-
Position: 2
210+
Position: 1
211211
Default value: None
212212
Accept pipeline input: False
213213
Accept wildcard characters: False
@@ -227,7 +227,7 @@ Parameter Sets: SchemaFile
227227
Aliases:
228228
229229
Required: False
230-
Position: Named
230+
Position: 1
231231
Default value: None
232232
Accept pipeline input: False
233233
Accept wildcard characters: False

reference/7.4/Microsoft.PowerShell.Utility/Test-Json.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Utility
5-
ms.date: 03/14/2024
5+
ms.date: 07/24/2024
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/test-json?view=powershell-7.4&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
title: Test-Json
@@ -226,7 +226,7 @@ Parameter Sets: JsonString, JsonStringWithSchemaString, JsonStringWithSchemaFile
226226
Aliases:
227227

228228
Required: True
229-
Position: 1
229+
Position: 0
230230
Default value: None
231231
Accept pipeline input: True (ByValue)
232232
Accept wildcard characters: False
@@ -247,9 +247,9 @@ Parameter Sets: JsonLiteralPath, JsonLiteralPathWithSchemaString, JsonLiteralPat
247247
Aliases: PSPath, LP
248248

249249
Required: True
250-
Position: Named
250+
Position: 0
251251
Default value: None
252-
Accept pipeline input: False
252+
Accept pipeline input: True (ByPropertyName)
253253
Accept wildcard characters: False
254254
```
255255
@@ -266,9 +266,9 @@ Parameter Sets: JsonPath, JsonPathWithSchemaString, JsonPathWithSchemaFile
266266
Aliases:
267267

268268
Required: True
269-
Position: Named
269+
Position: 0
270270
Default value: None
271-
Accept pipeline input: False
271+
Accept pipeline input: True (ByPropertyName)
272272
Accept wildcard characters: True
273273
```
274274
@@ -285,8 +285,8 @@ Type: System.String
285285
Parameter Sets: JsonStringWithSchemaString, JsonLiteralPathWithSchemaString, JsonPathWithSchemaString
286286
Aliases:
287287
288-
Required: False
289-
Position: 2
288+
Required: True
289+
Position: 1
290290
Default value: None
291291
Accept pipeline input: False
292292
Accept wildcard characters: False
@@ -305,8 +305,8 @@ Type: System.String
305305
Parameter Sets: JsonStringWithSchemaFile, JsonLiteralPathWithSchemaFile, JsonPathWithSchemaFile
306306
Aliases:
307307
308-
Required: False
309-
Position: Named
308+
Required: True
309+
Position: 1
310310
Default value: None
311311
Accept pipeline input: False
312312
Accept wildcard characters: False

reference/7.5/Microsoft.PowerShell.Utility/Test-Json.md

Lines changed: 46 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
external help file: Microsoft.PowerShell.Commands.Utility.dll-Help.xml
33
Locale: en-US
44
Module Name: Microsoft.PowerShell.Utility
5-
ms.date: 03/14/2024
5+
ms.date: 07/24/2024
66
online version: https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/test-json?view=powershell-7.5&WT.mc_id=ps-gethelp
77
schema: 2.0.0
88
title: Test-Json
@@ -18,55 +18,61 @@ Tests whether a string is a valid JSON document
1818
### JsonString (Default)
1919

2020
```
21-
Test-Json [-Json] <String> [<CommonParameters>]
21+
Test-Json [-Json] <String> [-Options <String[]>] [<CommonParameters>]
2222
```
2323

2424
### JsonStringWithSchemaString
2525

2626
```
27-
Test-Json [-Json] <string> [-Schema] <string> [<CommonParameters>]
27+
Test-Json [-Json] <String> [-Schema] <String> [-Options <String[]>]
28+
[<CommonParameters>]
2829
```
2930

3031
### JsonStringWithSchemaFile
3132

3233
```
33-
Test-Json [-Json] <string> [-SchemaFile] <string> [<CommonParameters>]
34+
Test-Json [-Json] <String> -SchemaFile <String> [-Options <String[]>]
35+
[<CommonParameters>]
3436
```
3537

3638
### JsonPath
3739

3840
```
39-
Test-Json [-Path] <string> [<CommonParameters>]
41+
Test-Json -Path <String> [-Options <String[]>] [<CommonParameters>]
4042
```
4143

4244
### JsonPathWithSchemaString
4345

4446
```
45-
Test-Json [-Path] <string> [-Schema] <string> [<CommonParameters>]
47+
Test-Json -Path <String> [-Schema] <String> [-Options <String[]>]
48+
[<CommonParameters>]
4649
```
4750

4851
### JsonPathWithSchemaFile
4952

5053
```
51-
Test-Json [-Path] <string> [-SchemaFile] <string> [<CommonParameters>]
54+
Test-Json -Path <String> -SchemaFile <String> [-Options <String[]>]
55+
[<CommonParameters>]
5256
```
5357

5458
### JsonLiteralPath
5559

5660
```
57-
Test-Json [-LiteralPath] <string> [<CommonParameters>]
61+
Test-Json -LiteralPath <String> [-Options <String[]>] [<CommonParameters>]
5862
```
5963

6064
### JsonLiteralPathWithSchemaString
6165

6266
```
63-
Test-Json [-LiteralPath] <string> [-Schema] <string> [<CommonParameters>]
67+
Test-Json -LiteralPath <String> [-Schema] <String> [-Options <String[]>]
68+
[<CommonParameters>]
6469
```
6570

6671
### JsonLiteralPathWithSchemaFile
6772

6873
```
69-
Test-Json [-LiteralPath] <string> [-SchemaFile] <string> [<CommonParameters>]
74+
Test-Json -LiteralPath <String> -SchemaFile <String> [-Options <String[]>]
75+
[<CommonParameters>]
7076
```
7177

7278
## DESCRIPTION
@@ -226,7 +232,7 @@ Parameter Sets: JsonString, JsonStringWithSchemaString, JsonStringWithSchemaFile
226232
Aliases:
227233

228234
Required: True
229-
Position: 1
235+
Position: 0
230236
Default value: None
231237
Accept pipeline input: True (ByValue)
232238
Accept wildcard characters: False
@@ -247,6 +253,29 @@ Parameter Sets: JsonLiteralPath, JsonLiteralPathWithSchemaString, JsonLiteralPat
247253
Aliases: PSPath, LP
248254

249255
Required: True
256+
Position: 0
257+
Default value: None
258+
Accept pipeline input: True (ByPropertyName)
259+
Accept wildcard characters: False
260+
```
261+
262+
### -Options
263+
264+
By default, `Test-Json` doesn't support JSON containing comments or trailing commas. This parameter
265+
allows you to specify options to change the default behavior. The following options are available:
266+
267+
- `IgnoreComments`
268+
- `AllowTrailingCommas`
269+
270+
This parameter was added in PowerShell 7.5.0-preview.4.
271+
272+
```yaml
273+
Type: System.String[]
274+
Parameter Sets: (All)
275+
Aliases:
276+
Accepted values: IgnoreComments, AllowTrailingCommas
277+
278+
Required: False
250279
Position: Named
251280
Default value: None
252281
Accept pipeline input: False
@@ -266,9 +295,9 @@ Parameter Sets: JsonPath, JsonPathWithSchemaString, JsonPathWithSchemaFile
266295
Aliases:
267296
268297
Required: True
269-
Position: Named
298+
Position: 0
270299
Default value: None
271-
Accept pipeline input: False
300+
Accept pipeline input: True (ByPropertyName)
272301
Accept wildcard characters: True
273302
```
274303

@@ -285,8 +314,8 @@ Type: System.String
285314
Parameter Sets: JsonStringWithSchemaString, JsonLiteralPathWithSchemaString, JsonPathWithSchemaString
286315
Aliases:
287316
288-
Required: False
289-
Position: 2
317+
Required: True
318+
Position: 1
290319
Default value: None
291320
Accept pipeline input: False
292321
Accept wildcard characters: False
@@ -305,8 +334,8 @@ Type: System.String
305334
Parameter Sets: JsonStringWithSchemaFile, JsonLiteralPathWithSchemaFile, JsonPathWithSchemaFile
306335
Aliases:
307336
308-
Required: False
309-
Position: Named
337+
Required: True
338+
Position: 1
310339
Default value: None
311340
Accept pipeline input: False
312341
Accept wildcard characters: False

0 commit comments

Comments
 (0)