Skip to content

'undefined' not considered JSON serializable? #1501

Answered by nvie
dBianchii asked this question in Help
Discussion options

You must be logged in to vote

Unfortunately, JavaScript does not allow undefined values to be serialized in JSON arrays. An array like [undefined] would become [null] on the other end, due to the fact that JSON.parse(JSON.stringify([undefined]) returns [null]. This is unfortunately out of our control. We therefore decided to not allow undefined values as list members, because this implicit conversion could take people by surprise.

Hope that helps to explain it.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nvie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants