下面是我需要传递给 API 的键值对。不知道我哪里错了
$Body = @{
hostName = 'null'
hostOperatingSystem = 0
optionalFilter1 = 'null'
optionalFilter2 = 'null'
description = 'null'
serviceName = "ServiceManager.Logging"
sectionName = "Services"
signature = 'null'
value = @( @{
Services = @( @{
FullPath = "..\Service\MicroService.exe"
InstanceCount = 2
})
})
} | ConvertTo-Json -Depth 4
$Response = Invoke-RestMethod -Uri $URI -Method PUT -Headers $Headers -Body $Body -ContentType 'application/json'
下面是我得到的错误
Invoke-RestMethod : {"":["JsonToken EndArray is not valid for closing JsonType Object. Path '', line 14, position 15."],"value":["Unexpected character encountered while parsing value: [. Path 'value', line 5, position 15."]}