Poswershell Invoke-RestMethod返回PSObject,其中包含数组中的一些数据,但不是全部

时间:2018-02-22 05:55:53

标签: rest powershell-v3.0

我正在尝试对通过Invoke-restMethod返回的两个对象使用Compare-Object。

使用供应商swagger页面,所有元素都完全暴露。 IE没有数组:

    {
  "type": "SP",
  "id": "12345tygvcxsaw23456y",
  "name": "Stormtrooper",
  "entityId": "sb01.stormtrooper.com/SAML2",
  "active": true,
  "contactInfo": {
    "company": "Empire",
    "firstName": "Darth",
    "lastName": "Vader",
    "email": "DVader@stormtrooper.com"
  },
  "loggingMode": "STANDARD",
  "virtualEntityIds": [],
  "licenseConnectionGroup": "",
  "credentials": {
    "certs": [
      {
        "primaryVerificationCert": true,
        "secondaryVerificationCert": false,
        "certView": {
          "id": "bnjki98765rfvb",
          "serialNumber": "12345678912345678123456789",
          "subjectDN": "CN=stormtrooper.com, O=\"Empire, Inc.\", L=Tatooine, ST=Utah, C=US, OID.2.5.4.17=23456, STREET=3301 N Thanksgiving Way Ste. 100

当我使用Invoke-RestMethod获得相同的返回时,似乎两个深的元素放在一个数组中:

    {
  "type": "SP",
  "id": "12345tygvcxsaw23456y",
  "name": "Stormtrooper",
  "entityId": "sb01.stormtrooper.com/SAML2",
  "active": true,
  "contactInfo": {
    "company": "Empire",
    "firstName": "Darth",
    "lastName": "Vader",
    "email": "DVader@stormtrooper.com"
  },
  "loggingMode": "STANDARD",
  "virtualEntityIds": [],
  "licenseConnectionGroup": "",
  "credentials":  {
                    "certs":  [
                                  "@{primaryVerificationCert=True; secondaryVerificationCert=False; certView=; x509File=; encryptionCert=False}"
                              ],
                    "signingSettings":  {
                                            "signingKeyPairRef":  "@{id=98765edfghu8765rfgh; location=xxx}",

有没有办法'强制'调用Invoke-restMethod来返回完全展开的响应?

0 个答案:

没有答案