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…”
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…”
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
orfalse
). 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.