简体中文 | Powershell Gallery | GitHub | Gitee | GitCode
Star ⭐️ or Donate 💰 if you like it!
JSON to Hashtable Conversion for Windows PowerShell 5+, similar to ConvertFrom-Json -AsHashtable in PowerShell 7+.
- PowerShell 7+: Directly delegates to the native
ConvertFrom-Json -AsHashtable. - PowerShell 5+: Uses a hand-written iterative JSON parser.
-
Install-Module ConvertFrom-JsonAsHashtable
-
Install-PSResource ConvertFrom-JsonAsHashtable
-
scoop install abyss/abgox.ConvertFrom-JsonAsHashtable
$jsonString = '{
"key1": "value1",
"key2": {
"subKey1": "subValue1",
"subKey2": ["item1", "item2"]
},
"key3": [
{"nestedKey1": "nestedValue1"},
{"nestedKey2": "nestedValue2"}
]
}'
$jsonString | ConvertFrom-JsonAsHashtable