JSON and Algebraic Data Types
From OO to Clojure Workshop!
Watch my free workshop to help you learn Clojure faster and shift your paradigm to functional.
I recently wrote about the birth of JSON, which describes how JSON came to be and the story of its success. Crawford talks about how JSON (or a very close equivalent) was reinvented several times throughout the years.
What strikes me is that JSON turned out to be an Algrebraic Data Type (ADT). Specifically, it is a tagged union.
JSON ADT variants:
With these six constructors, you can make all of JSON.
Could its ADT nature be one of the secrets to JSON's success?