Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SerializationOptions enum value SupressNullValuedProperties / enable the option to not output null values #129

Closed
JohnLBevan opened this issue Jul 25, 2024 · 2 comments · Fixed by #137

Comments

@JohnLBevan
Copy link

Today I can run @{one=1;two=$null} | ConvertTo-Yaml producing the below output:

one: 1
two:

It would be good to have the ability to prevent the output of fields with null values, so callers can choose to toggle this behaviour where their inputs contain properties with null values instead of simply not containing those properties.

Desired behaviour: @{one=1;two=$null} | ConvertTo-Yaml -Options SupressNullValuedProperties would produce the output:

one: 1
@gabriel-samfira
Copy link
Member

Hi @JohnLBevan

I opened a PR here:

Is this what you had in mind?

@JohnLBevan
Copy link
Author

That's awesome / exactly what I was after; thank-you @gabriel-samfira

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants