I'm working on a PowerShell client to a NoSQL-backed database. Not all of the documents in the table I query have the exact same set of properties. When using ConvertFrom-Json to serialize this payload the first JSON array item dictates the properties available to all other objects in the JSON payload.
Example:
@"
[
    {
        "thing1":  "bob",
        "thing2":  "mary"
    },
    {
        "thing1":  "bob",
        "thing2":  "mary",
        "thing3":  "tom"
    }
]
"@ | ConvertFrom-Json
thing1 thing2
------ ------
bob    mary
bob    mary
@"
[
    {
        "thing1":  "bob",
        "thing2":  "mary",
        "thing3":  "tom"
    },
    {
        "thing1":  "bob",
        "thing2":  "mary"
    }
]
"@ | ConvertFrom-Json
thing1 thing2 thing3
------ ------ ------
bob    mary   tom
bob    mary
Is this expected behavior? Is there a way around this other than attempting to parse the raw JSON on my own?
I'm currently using PowerShell 5.1:
$PSVersionTable
Name                           Value
----                           -----
PSVersion                      5.1.18362.1801
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.18362.1801
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1