Skip to content

Commit

Permalink
Changing convertfrom-json utility based on powershell version
Browse files Browse the repository at this point in the history
  • Loading branch information
Pallavi Sah committed Oct 27, 2023
1 parent d7d89cd commit 86dd124
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion arm-ttk/ConvertFrom-JSON.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ process

# First, strip block comments
$inObj = $_
$in = if ($InputObject.Contains('*/')) {
$in = if ($InputObject.Contains('*/') -and $InputObject.Contains('/*')) {
$JSONBlockComments.Replace($inObj,'')
} else {
$InputObject
Expand Down
3 changes: 2 additions & 1 deletion arm-ttk/arm-ttk.psm1
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#region JSON Functions
if ($PSVersionTable.PSEdition -ne 'Core') {
#powershell 6+ provides support for json with comments
if ($PSVersionTable.PSVersion.Major -lt 5) {
. $psScriptRoot\ConvertFrom-Json.ps1 # Overwriting ConvertFrom-JSON to allow for comments within JSON (not on core)
}

Expand Down

0 comments on commit 86dd124

Please sign in to comment.