Exports all settings stored in $items to .\file.json.
If the file already exists, the new settings will be merged into the existing file.
#>[CmdletBinding()]Param([Sqlcollaborative.Dbatools.Configuration.Config[]]$Config,[string]$Path,[switch]$Replace)begin{$parent=Split-Path-Path$Pathif(-not(Test-Path$parent)){$null=New-Item$parent-ItemTypeDirectory-Force}$data=@{}if((Test-Path$Path)-and(-not$Replace)){foreach($itemin(Get-Content-Path$Path-EncodingUTF8|ConvertFrom-Json)){$data[$item.FullName]=$item}}}process{foreach($itemin$Config){$datum=@{Version=1FullName=$item.FullName}if($item.SimpleExport){$datum["Data"]=$item.Value}else{$persisted=[Sqlcollaborative.Dbatools.Configuration.ConfigurationHost]::ConvertToPersistedValue($item.Value)$datum["Value"]=$persisted.PersistedValue$datum["Type"]=$persisted.PersistedType$datum["Style"]="default"}$data[$item.FullName]=[pscustomobject]$datum}}end{$data.Values|ConvertTo-Json|Set-Content-Path$Path-EncodingUTF8-ErrorActionStop}}