Skip to content

Commit be3e918

Browse files
committed
refactor to use Test-Json instead
1 parent 4b8ff23 commit be3e918

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Tenant/Standards/Invoke-ListStandardsCompare.ps1

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,8 @@ function Invoke-ListStandardsCompare {
6565

6666
if ($FieldValue -is [System.Boolean]) {
6767
$FieldValue = [bool]$FieldValue
68-
} elseif ($FieldValue -like '[{*') {
69-
try {
70-
$FieldValue = ConvertFrom-Json -InputObject $FieldValue -ErrorAction SilentlyContinue
71-
} catch {
72-
$FieldValue = [string]$FieldValue
73-
}
68+
} elseif (Test-Json -Json $FieldValue -ErrorAction SilentlyContinue) {
69+
$FieldValue = ConvertFrom-Json -InputObject $FieldValue -ErrorAction SilentlyContinue
7470
} else {
7571
$FieldValue = [string]$FieldValue
7672
}

0 commit comments

Comments
 (0)