Skip to content

Can I force input key names remain as such, rather than become values of key and value? If so, how? #151

Closed Answered by gabriel-samfira
RokeJulianLockhart asked this question in Q&A
Discussion options

You must be logged in to vote

PsCustomObjects are not hash tables or dictionaries. They are different data structures. Powershell-yaml uses hashtables for mappings. The built in json commandlets use PsCustomObjects.

If you pass a hashtable or dictionary to Format-List it will give you the output you saw.

So the questions are: do you absolutely need PsCustomObjects? Is the issue that Format-List handles hash tables differently than PsCustomObjects? Is there an issue you're encountering when using hashtables instead of PsCustomObjects outside of how Format-list displays the contents of the hashtable?

Replies: 2 comments 11 replies

Comment options

You must be logged in to vote
7 replies
@RokeJulianLockhart
Comment options

@gabriel-samfira
Comment options

Answer selected by RokeJulianLockhart
@RokeJulianLockhart
Comment options

@gabriel-samfira
Comment options

@RokeJulianLockhart
Comment options

@gabriel-samfira
Comment options

Comment options

You must be logged in to vote
4 replies
@gabriel-samfira
Comment options

@RokeJulianLockhart
Comment options

@gabriel-samfira
Comment options

@RokeJulianLockhart
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants