ConvertFrom-Json failure

Hey All,

I’m trying to Convert a file from Json to a PS Object. I can run Get-Content command and load the json file into a variable. I can then execute that variable and the json file is returned accurately to the screen.

My issue is that when I run $variable | ConvertFrom-Json it returns the following:

data

@{databaseTablesConnection=}

I’ve tried messing around with some of the parameters of the ConvertFrom-Json command such as -depth and it does not make a difference. Shouldn’t PowerShell be able to parse this json file and load it as a PS object?

I’ve given an example of the Json file below.

Thanks!

{
  "data": {
    "databaseTablesConnection": {
      "nodes": [
        {
          "id": "xxxx",
          "luid": "xxxx",
          "vizportalId": "xxx",
          "name": "'xxxx'",
          "fullName": "['xxxx']",
          "connectionType": "xxxx",
          "description": "",
          "isCertified": xxx,
          "certifier": null,
          "certificationNote": "",
          "isEmbedded": true,
          "schema": "",
          "contact": null,
          "database": {
            "luid": "xxxx",
            "name": "xxxxx"
          },
          "dataQualityWarning": null
        },
        {
          "id": "xxxx",
          "luid": "xxxx",
          "vizportalId": "xxx",
          "name": "'xxxx'",
          "fullName": "['xxxx']",
          "connectionType": "xxxx",
          "description": "",
          "isCertified": xxx,
          "certifier": null,
          "certificationNote": "",
          "isEmbedded": true,
          "schema": "",
          "contact": null,
          "database": {
            "luid": "xxxx",
            "name": "xxxxx"
          },
          "dataQualityWarning": null
        },
        {
          "id": "xxxx",
          "luid": "xxxx",
          "vizportalId": "xxx",
          "name": "'xxxx'",
          "fullName": "['xxxx']",
          "connectionType": "xxxx",
          "description": "",
          "isCertified": xxx,
          "certifier": null,
          "certificationNote": "",
          "isEmbedded": true,
          "schema": "",
          "contact": null,
          "database": {
            "luid": "xxxx",
            "name": "xxxxx"
          },
          "dataQualityWarning": null
        
        
        }
      ]
    }
  }
}

Despite some missing quotation marks for the values of "isCertified" … PowerShell did exactly this. And “data” is the root of your JSON data object. :man_shrugging:t3: I cannot see any failure or error. Do you?

What did you expect? Or what would you like to do with the data?

Okay, so my issue might be a simple one. How can I see the rest of the data once it has been converted to PS object. Is it possible for PS to display more fields than the root of my json data object? If so how?

Honestly, I’m not trying to do anything in particular. I’m just trying to learn how to work with powershell and json files.

Ah! I figured it out. Still getting use to the object notation. I can just drill down the PS Object with data.databaseTablesConnection.nodes

1 Like

Great. I’m proud of you. :+1:t3: :love_you_gesture:t3: