Skip to content

The ConvertFrom-Json method does not have the -AsHashtable switch in Windows PowerShell, which makes it difficult to convert json to hashtable. This module is used to solve this problem.

License

Notifications You must be signed in to change notification settings

bakingclouds6x/ConvertFrom-JsonToHashtable

 
 

Repository files navigation

✨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

About

The ConvertFrom-Json method does not have the -AsHashtable switch in Windows PowerShell, which makes it difficult to convert json to hashtable. This module is used to solve this problem.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PowerShell 100.0%