Mapping of Python Datatypes to JSON

Since json is not Python-specific, there are some mismatches in its coverage of Python datatypes. Some of them are simply naming differences, but there is two important Python datatypes that are completely missing. See if you can spot them:

Notes JSON Python 3
object dictionary
array list
string string
integer integer
real number float
* true True
* false False
* null None

*All JSON values are case-sensitive.

Did you notice what was missing? Tuples & bytes! JSON has an array type, which the json module maps to a Python list, but it does not have a separate type for “frozen arrays” (tuples). And while json supports strings quite nicely, it has no support for bytes objects or byte arrays.

Get hands-on with 1200+ tech skills courses.