257

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…”

you are viewing a single comment's thread
view the rest of the comments
[-] semperverus@lemmy.world 41 points 1 year ago* (last edited 1 year ago)

JSON has types.

Many API developers may choose not to use them, but they are absolutely there.

You specify the type by including or excluding quotation marks, and then for the types without quotation marks, you either include or exclude a decimal point to specify float or integer, and for boolean you use characters (specifically true or false). Arrays are wrapped in [] and objects are wrapped in {}.

JSON data as a whole is passed as one giant string because the REST protocol demands it. But once it's been pulled in and properly interpreted, there are absolutely types in the data.

[-] suction@lemmy.world 12 points 1 year ago

Absolutely. Who doesn’t type JSON?

[-] meliaesc@lemmy.world 7 points 1 year ago* (last edited 1 year ago)

We aren't using json.atChar(17) to get values?

[-] semperverus@lemmy.world 2 points 1 year ago* (last edited 1 year ago)

I'm not sure if i'm missing a joke here, so:

In case you're making a joke: The people who don't type JSON are using controllers.

In case you're asking a serious question: the people who don't type JSON are the people in OP's image. They are technically using types, but that type is literally always string. They don't use integers, they don't use booleans. This is functional but may not be the best choice, depending on what kinds of data their system is supposed to handle.

[-] Bach37strad@lemmy.world 1 points 1 year ago

Would you mind elaborating a bit for someone who doesn't do much coding? I'm guessing I'm one of the people you're talking about.

The only coding I've done has been via json for raspberry pi, 3d printer, and homeassistant applications.

I know it's a text base language, but how do it's commands relate to integers? I've used boolean, I get that bit.

[-] netvor@lemmy.world 0 points 11 months ago

Great post, but I have to "well, actually" you on this little thing:

the REST protocol demands it.

REST is not a protocol, and does not have to do anything with JSON.

(eg. How Did REST Come To Mean The Opposite of REST? by Carson Gross)

this post was submitted on 30 Jun 2024
257 points (97.1% liked)

Programmer Humor

37235 readers
22 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 6 years ago
MODERATORS