Use a key value built in schema with JSON

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the data category.

Last Updated: 2021-05-15

I saved some data about tutors in the following format

[
  [
    69,
    "University of Law",
    "I am a practising solicitor with 2 years PQE. I am very interested in tutoring law.",
    true
    false
  ]

A week later, I had to work with this exported data. Being in an unlabelled array, I had no idea what some of the fields referred to, so I had to consult the creation code. It was also annoying to program by array indices instead of keys.

I should have exported the data as a dict-like object (or JSON):

{
  "id": 69,
  "institution": "univerity of law",
  "description": "I am a practising",
  "law_degree": true,
  "online_offered": true
}