Unit 15Reading JSON Files

JSON is a lightweight data interchange format. Unlike pickle (mentioned earlier here), JSON is language-independent but more restricted in terms of data representation.

JSON: Who Cares?

images/aside-icons/info.png

Many popular websites, such as Twitter,[9] Facebook,[10] and Yahoo! Weather,[11] provide APIs that use JSON as the data interchange format.

JSON supports the following data types:

  • Atomic data types—strings, numbers, true, false, null

  • Arrays—an array corresponds to a Python list; it’s enclosed in square brackets []; the items in an array don’t have to be of the same data type:

     [1, 3.14, ​"a string"​, true, null]
  • Objects—an object ...

Get Data Science Essentials in Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.