Due to JSON’s ubiquity, we end up reaching for JSON libraries
regularly when we have a project that needs to exchange data with
other systems. Whenever something becomes widespread and becomes an
“infrastructure”, it turns into a black-box in people’s minds.
One reason JSON got so popular is the fact that it’s simple. It’s
not the simplest solution to the problem, not by a long shot, but
it’s flexible enough to solve a lot of problems without becoming too
large. In this post we’ll be making a JSON serializer in Python that
can serialize arbitrary nested data structures in a few lines of
code. And more importantly, every part should be understandable and
self-contained.