Skip to content

Commit

Permalink
Merge pull request #755 from psah434/json
Browse files Browse the repository at this point in the history
Changing convertfrom-json utility usage based on powershell version (powershell 6+ has utility for json comments)
  • Loading branch information
psah434 authored Nov 18, 2023
2 parents 6bd4830 + b182fd0 commit 45f84e6
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 6) {
. $psScriptRoot\ConvertFrom-Json.ps1 # Overwriting ConvertFrom-JSON to allow for comments within JSON (not on core)
}

Expand Down

0 comments on commit 45f84e6

Please sign in to comment.