You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
ConvertFrom-Json does not convert Newtonsoft.Json specific metadata properties in root object #7307
Notice that $id and $type properties are missing from resulting PSCustomObject
Expected behavior
ConvertFrom-Json does not ignore properties when deserializing into generic PSCustomObject, regardless of their name.
>'{"$id": 1, "$type": "System.String", "id": "value"}'|ConvertFrom-Json$id$type id
----------1 System.String value
Actual behavior
>'{"$id": 1, "$type": "System.String", "id": "value"}'|ConvertFrom-Json
id
--
value
Additional Notes
Issue does not occur when metadata properties are deeper in the hierarchy.
Other Newtonsoft.Json metadata properties include $values and $ref.
Environment data
>$PSVersionTable
Name Value
---------
PSVersion 6.1.0-preview.3
PSEdition Core
GitCommitId v6.1.0-preview.3
OS Microsoft Windows 10.0.17134
Platform Win32NT
PSCompatibleVersions {1.0,2.0,3.0,4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
changed the title [-]ConvertFrom-Json silently ignores Newtonsoft.Json specific metadata properties in root object[/-][+]ConvertFrom-Json does not convert Newtonsoft.Json specific metadata properties in root object[/+]on Jul 18, 2018
Activity
[-]ConvertFrom-Json silently ignores Newtonsoft.Json specific metadata properties in root object[/-][+]ConvertFrom-Json does not convert Newtonsoft.Json specific metadata properties in root object[/+]markekraus commentedon Jul 18, 2018
I can repro this. It also repros with
-AsHashtableand it does not repro on nested objects, only root.result: