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
Hashtables resulting from ConvertFrom-JSON -AsHashtable have case sensitive keys #6928
If the JSON contains a list with keys that only differ in casing. Without the switch, those keys would be seen as identical keys and therefore only the last one would get used.
Case sensitive hashtables are not the norm elsewhere --
group-object -AsHashTable does not produce case sensitive hashtables and neither does @{} with group-object being the reference for justifying the behavior and flag that was used.
I guess i'll leave this as a fun warning to anyone else using this cmdlet
Case sensitive hashtables are not the norm elsewhere
Yes, but -AsHashTable on convertfrom-json was implemented specifically to address the issue of case sensitive key names among other issues. It's by design and documented as such.
It probably should have been implemented as case insensitive by default with an option for case sensitive.
Activity
markekraus commentedon May 24, 2018
Bill Easton (@strawgate) Case sensitivity is
by designto accommodate case sensitive key names:{ "key1": "value1", "KEY1": "value2" }This is documented in
-AsHashtablefdocumentation:https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/convertfrom-json?view=powershell-6#optional-parameters
strawgate commentedon May 24, 2018
Case sensitive hashtables are not the norm elsewhere --
group-object -AsHashTabledoes not produce case sensitive hashtables and neither does@{}with group-object being the reference for justifying the behavior and flag that was used.I guess i'll leave this as a fun warning to anyone else using this cmdlet
markekraus commentedon May 24, 2018
Yes, but
-AsHashTableonconvertfrom-jsonwas implemented specifically to address the issue of case sensitive key names among other issues. It's by design and documented as such.It probably should have been implemented as case insensitive by default with an option for case sensitive.
strawgate commentedon May 25, 2018
Referencing the original PR: #5043