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
One thing that caught my attention right after reading the documentation is that trying to access a key that does not exist returns null. And thus this code works without panicking:
fnmain(){let null_test = json::object! {
bar: null,};assert!(null_test["foo"] == null_test["bar"]);}
There's a distinction between something that is undefined and a key with a null value but this crate does not have it.
This causes implications like introducing a bug where the wrong key name is used but the code won't complain because it will constantly accept that the value was null, even though the function may fail and thus not report. As an example think that if bar exists I know that part worked and returned nothing, while the service foo failed completely and thus was not appended.
The text was updated successfully, but these errors were encountered:
One thing that caught my attention right after reading the documentation is that trying to access a key that does not exist returns
null
. And thus this code works without panicking:There's a distinction between something that is
undefined
and a key with anull
value but this crate does not have it.This causes implications like introducing a bug where the wrong key name is used but the code won't complain because it will constantly accept that the value was null, even though the function may fail and thus not report. As an example think that if
bar
exists I know that part worked and returned nothing, while the servicefoo
failed completely and thus was not appended.The text was updated successfully, but these errors were encountered: