22external help file : Microsoft.PowerShell.Commands.Utility.dll-Help.xml
33Locale : en-US
44Module Name : Microsoft.PowerShell.Utility
5- ms.date : 03/14 /2024
5+ ms.date : 07/24 /2024
66online version : https://learn.microsoft.com/powershell/module/microsoft.powershell.utility/test-json?view=powershell-7.5&WT.mc_id=ps-gethelp
77schema : 2.0.0
88title : 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
226232Aliases :
227233
228234Required : True
229- Position : 1
235+ Position : 0
230236Default value : None
231237Accept pipeline input : True (ByValue)
232238Accept wildcard characters : False
@@ -247,6 +253,29 @@ Parameter Sets: JsonLiteralPath, JsonLiteralPathWithSchemaString, JsonLiteralPat
247253Aliases : PSPath, LP
248254
249255Required : 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
250279Position: Named
251280Default value: None
252281Accept pipeline input: False
@@ -266,9 +295,9 @@ Parameter Sets: JsonPath, JsonPathWithSchemaString, JsonPathWithSchemaFile
266295Aliases:
267296
268297Required: True
269- Position : Named
298+ Position: 0
270299Default value: None
271- Accept pipeline input : False
300+ Accept pipeline input: True (ByPropertyName)
272301Accept wildcard characters: True
273302` ` `
274303
@@ -285,8 +314,8 @@ Type: System.String
285314Parameter Sets: JsonStringWithSchemaString, JsonLiteralPathWithSchemaString, JsonPathWithSchemaString
286315Aliases:
287316
288- Required: False
289- Position: 2
317+ Required: True
318+ Position: 1
290319Default value: None
291320Accept pipeline input: False
292321Accept wildcard characters: False
@@ -305,8 +334,8 @@ Type: System.String
305334Parameter Sets: JsonStringWithSchemaFile, JsonLiteralPathWithSchemaFile, JsonPathWithSchemaFile
306335Aliases:
307336
308- Required: False
309- Position: Named
337+ Required: True
338+ Position: 1
310339Default value: None
311340Accept pipeline input: False
312341Accept wildcard characters: False
0 commit comments