English | 简体中文 | Github | Gitee
-
The
ConvertFrom-Json
method does not have the-AsHashtable
switch inWindows PowerShell
, which makes it inconvenient to convert json to hashtable. -
This module is used to solve this problem.
-
It will export a
ConvertFrom-JsonToHashtable
function. -
It's like
ConvertFrom-Json
, but it converts json directly into a hash table
-
Install:
Install-Module ConvertFrom-JsonToHashtable
-
Import:
Import-Module ConvertFrom-JsonToHashtable
-
Example:
-
$jsonString = '{ "key1": "value1", "key2": { "subkey1": "subvalue1", "subkey2": ["item1", "item2"] }, "key3": [ {"nestedkey1": "nestedvalue1"}, {"nestedkey2": "nestedvalue2"} ] }' $jsonString | ConvertFrom-JsonToHashtable
-