Skip to content

When parse object with an empty array it return [] #482

Answered by eemeli
namantam1 asked this question in Q&A
Discussion options

You must be logged in to vote

[] is the only available YAML representation of an empty array. The empty value you're expecting represents a null value.

To get what you want, I'd recommend using a replacer to replace empty arrays with undefined, which is ignored: https://eemeli.org/yaml/#yaml-stringify

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by namantam1
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