Skip to content

Latest commit

 

History

History
58 lines (48 loc) · 2.04 KB

README.md

File metadata and controls

58 lines (48 loc) · 2.04 KB

✨ConvertFrom-JsonToHashtable✨

English | 简体中文 | Github | Gitee

license code size repo size created


Introduce

  • The ConvertFrom-Json method does not have the -AsHashtable switch in Windows 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

How to Use

  1. Install: Install-Module ConvertFrom-JsonToHashtable

  2. Import: Import-Module ConvertFrom-JsonToHashtable

  3. Example:

    • $jsonString = '{
          "key1": "value1",
          "key2": {
              "subkey1": "subvalue1",
              "subkey2": ["item1", "item2"]
          },
          "key3": [
              {"nestedkey1": "nestedvalue1"},
              {"nestedkey2": "nestedvalue2"}
          ]
      }'
      
      $jsonString | ConvertFrom-JsonToHashtable