You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am not sure if this is wanted behavior, but if there is an array that has undefined as an element it stays as undefined.
JSON parse/stringify turns it into a null.
The same happens if a property is undefined, but with JSON it is completely stripped away.
In the README it says that undefined is only from supported from the lite, and JSON does not support undefined anyway.
I am assuming the way klona/json is intended to be used is we know in advance that our objects are JSON compatible in the first place, so this might be working as intended (but Map/Set are handled the same way as the JSON methods).
The text was updated successfully, but these errors were encountered:
PointSingularity
changed the title
Klona (JSON) preserves undefined in arrays
Klona (JSON) preserves undefined
Apr 30, 2024
I am not sure if this is wanted behavior, but if there is an array that has
undefined
as an element it stays as undefined.JSON parse/stringify turns it into a null.
The same happens if a property is
undefined
, but with JSON it is completely stripped away.In the
README
it says thatundefined
is only from supported from thelite
, and JSON does not supportundefined
anyway.Reproduction
I am assuming the way
klona/json
is intended to be used is we know in advance that our objects are JSON compatible in the first place, so this might be working as intended (but Map/Set are handled the same way as the JSON methods).The text was updated successfully, but these errors were encountered: