PowerShell / PowerShell/PowerShell-RFC

ConvertFrom/To-Hashtable and/or ConvertTo-PSCustomObject cmdlets

Open
#159 5 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Up-for-Grabs
Dominant language
PowerShell
Stars
467
Forks
140
Avg merge
9m
Merged PRs (30d)
1

Description

Related discussion in #109, specifically this comment:

Finally got around to reviewing this with @PowerShell/powershell-committee.

It sounds like the problem that's being solved here is to convert nested hashtables to PSCustomObjects when the keys are all strings (when they're not strings, conversion will likely result in key collision due to ToString() returning type names).

To that end, we think it's more generically useful to build a ConvertFrom-Hashtable cmdlet that would allow more generic and custom conversion of hashtables to PSCustomObjects and potentially other types using constructors that expect specific hashtable "schemas". Another possible implementation is to do a ConvertTo-PSCustomObject that does more custom handling (and these aren't mutually exclusive). Additionally, a ConvertTo-Hashtable is probably useful.

We don't have this on our radar right now, but if someone wants to give a go at a ConvertFrom-Hashtable RFC and implementation, go for it.

We think the scenario we're trying to address is primarily casting nested hashtables of hashtables into PSCustomObjects (or possibly even other types).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the related discussion in issue #109, especially the linked comment, to understand the proposed conversion scenarios and unresolved scope. Determine whether the work should cover ConvertFrom-Hashtable, ConvertTo-PSCustomObject, ConvertTo-Hashtable, or multiple cmdlets; done would require a focused RFC ready for PowerShell Committee feedback and a vote.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.