Meme transcription:

Panel 1: Bilbo Baggins ponders, “After all… why should I care about the difference between int and String?

Panel 2: Bilbo Baggins is revealed to be an API developer. He continues, “JSON is always String, anyways…”

2 points

The comment section proves that xml is far superior to json

permalink
report
reply
0 points

XML is all round better than Json.

permalink
report
parent
reply
5 points

json doesn’t have ints, it has Numbers, which are ieee754 floats. if you want to precisely store the full range of a 64 bit int (anything larger than 2^53 -1) then string is indeed the correct type

permalink
report
reply
1 point

Let me show you what Ethan has to say about this: https://feddit.org/post/319546/174361

permalink
report
parent
reply
1 point

json doesn’t have ints, it has Numbers, which are ieee754 floats.

No. numbers in JSON have arbitrary precision. The standard only specifies that implementations may impose restrictions on the allowed values.

This specification allows implementations to set limits on the range and precision of numbers accepted. Since software that implements IEEE 754 binary64 (double precision) numbers [IEEE754] is generally available and widely used, good interoperability can be achieved by implementations that expect no more precision or range than these provide, in the sense that implementations will approximate JSON numbers within the expected precision. A JSON number such as 1E400 or 3.141592653589793238462643383279 may indicate potential interoperability problems, since it suggests that the software that created it expects receiving software to have greater capabilities for numeric magnitude and precision than is widely available.

https://www.rfc-editor.org/rfc/rfc8259.html#section-6

permalink
report
parent
reply
44 points

These JSON memes got me feeing like some junior dev out there is upset because they haven’t read and understood the docs.

permalink
report
reply
6 points

Comments? Comments? Who needs comments?

permalink
report
parent
reply
26 points

You guys have docs?

permalink
report
parent
reply
0 points

You guys can read?

permalink
report
parent
reply
2 points

The code is my bible.

permalink
report
parent
reply
6 points

The schema is this SQL statement

permalink
report
parent
reply
46 points

"true"

permalink
report
parent
reply
14 points

Timing is about right for it to be a batch of newly minted CS grads getting into their first corporate jobs.

permalink
report
parent
reply
6 points

It’s the API’s job to validate it either way. As it does that job, it may as well parse the string as an integer.

permalink
report
reply
16 points
Deleted by creator
permalink
report
parent
reply
17 points

Or even funnier: It gets parsed in octal, which does yield a valid zip code. Good luck finding that.

permalink
report
parent
reply
3 points

Who tf decided that a 0 prefix means base 8 in the first place? If a time machine was invented somehow I’m going to cap that man, after the guy that created JavaScript.

permalink
report
parent
reply
5 points

Well shit, my zip code starts with a 9.

permalink
report
parent
reply
3 points

Oof.

I guess this is one of the reasons that some linters now scream if you don’t provide base when parsing numbers. But then again good luck finding it if it happens internally. Still, I feel like a ZIP should be treated as a string even if it looks like a number.

permalink
report
parent
reply
6 points

I refuse to validate data that comes from the backend I specifically develop against.

permalink
report
parent
reply
8 points

permalink
report
parent
reply
7 points

Explicit types are just laziness, you should be catching exceptions anyways.

permalink
report
reply
8 points

I do. I return an error.

permalink
report
parent
reply

Programmer Humor

!programmer_humor@programming.dev

Create post

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics

Community stats

  • 9.5K

    Monthly active users

  • 861

    Posts

  • 33K

    Comments