![](/static/23fb711/assets/icons/icon-96x96.png)
![](https://lemmy.ml/pictrs/image/c0ed0a36-2496-4b4d-ac77-7d2fd7f2b5b7.png)
try to stick with integers in a currency’s smallest unit of division
And then the marketing department comes up with products that cost 1.5ct apiece.
try to stick with integers in a currency’s smallest unit of division
And then the marketing department comes up with products that cost 1.5ct apiece.
Both instances are legal serialized JSON. What makes you think otherwise?
So it sounds like an issue with […] handling per-spec the presence of data which you don’t use.
The trouble is, in this specific use case, the data may either be there or it may not be, depending on authorization. I’m checking specifically if the key is present to determine whether the user has access to that data (and display a toggle for that data), or if the user mustn’t see it and thus doesn’t need the toggle.
The wrong assumption was that if the key is there, then the value is not null. That assumption was invalidated by an update on the server side. Of course I could’ve checked if the value of the key is nullish. But it’s still annoying to have a breaking frontend because the backend changed how it serves its data.
Holy shit, I’m sorry.
Though I once proposed an API like that for user preferences. I just needed “someone” (that wasn’t the client) to store a bunch of data for me. The backend doesn’t interpret it, the backend doesn’t edit it, so why should they deserialize and serialize it again? Just give it to me when I ask for it, kay?
To be fair, just because obj.foo
is undefined, that doesn’t mean the key is missing. It could also be assigned the value undefined. const obj = { foo: undefined }
vs const obj = {}
If an attribute is null, I would prefer to simply not serialize it.
That’s interesting. I’m on the opposite team. If a customer model defines an optional birthday, for instance, I’d rather have it serialized as a null value if it’s not available for a specific customer.
Indeed, and that turns out to be a problem if the JavaScript expects the key not to be there, but instead it is there. And then you try to tell the backend dev that the key shouldn’t be there, but he’ll try to convince you that it’s the same whether the key is not there or whether it’s assigned null
and then you wonder if he’s messing with you, but actually he isn’t and then the only thing keeping you sane is bitching about it in meme form on lemmy.
Yay, a likeminded person!
For Microsoft I fully understand that they’d rather have a subscription model for Windows. After all you’re getting updates every fortnight and critical patches ASAP. I wonder they let you buy their shit for so long.
Just in case someone brings it up—and someone will bring it up regardless—: I’m not defending their recent enshittification and “always online” mindset.
The Wall
The Berlin Wall? Pink Floyd’s The Wall? The US-Mexico border wall? More details, please.
I’m amazed that no-one has complained that the graph’s data points are on the borders between categories rather than inside the category bars.
With that out of the way: WTF is wrong with that graph?
Is an alternative spelling to extroversion and more close to the original Latin root.
I used to think that at least the parts that are Fairtrade wouldn’t be affected as much.
Chocolate production is infested with slave labor, child labor and child slave labor.
For long hair it helps with combing. Just like the old silicone spray for ballpoint mice, it reduces friction with the comb.
If I can control my fans and my GPU in Linux the way I can in Windows I will.
Guess I lost that gamble.
This neo: https://neo-layout.org/Layouts/neo/
That’s an en dash. This is an em dash: —
Don’t you guys have dead keys? On German keyboards there’s a key that does nothing on its own. When you press it twice, you get ‘`’, and when you press that button and ‘e’ you get è.
Many people confuse this for the apostrophe which brings me into a murderous rage every time I see it.
The instance I was bitching about was this: There’s a lot of region-specific data coming from the backend. But the user is only authorized for certain regions. So for instance the North-American guy gets this object:
{ "CA": [/* list of stuff */], "US": [/* list of stuff */], "MX": [ /* list of stuff */ ]}
, while the US-only guy only gets{"US": [ /* list of stuff */] }
. Are you suggesting that the response should also include flagsisCaPresent
,isUsPresent
,isMxPresent
for every country?The issue with
null
vs not present surfaced because I, the frontend, checked if the returned object contained the key"CA"
and then tried to iterate over the list of stuff, which happened to be null, which is hard to iterate over. I agree that I could’ve checked if the key was present and not null.The meme, however, was lamenting that the backend developer, refuses to acknowledge that these two JSONs are different,since they only see their POJOs, where both map to
CA: null, US: [], MX: null
.