Closed ianatha closed 1 year ago
From what I understand, the underlying issue is that null
JSON values are parsed as None. This is indeed a pervasive issue across many fields.
It seems that a get(key, default_value)
method for dict
that returns the default_value
not only when the key isn't in the dict, but also when the corresponding value in the dict is None would solve this issue across the board.
Also added a simple test case based on the data my deleted robot is returning.
@natekspencer let me know what you think
From what I understand, the underlying issue is that
null
JSON values are parsed as None. This is indeed a pervasive issue across many fields.
Correct
It seems that a
get(key, default_value)
method fordict
that returns thedefault_value
not only when the key isn't in the dict, but also when the corresponding value in the dict is None would solve this issue across the board.
While it may solve for issues where we want a non-None value, it may introduce problems where we actually want to check for the None value and act on that. Without a more thorough examination, to arbitrarily adjust the dict at this point is not recommended.
I think in this scenario, where the only information seems to be an id and a name, it would actually be better to not try to load a robot at all. i.e. we should check if litterRobotSerial
is null and not create a robot for that particular array element.
That looks good to me. I'll wait for @tkdrob's input before merging right away.
Fixes #159