Convert from JSON to markdown/html table

I have data about a persons occupations in JSON and would like to convert this to a table - either in markdown or html.

Right now I use AI - but it would be nice to do it more directly and with greater control of the output.

The prompt I use for AI is

Create a table layout using markdown.

There should be 3 columns.
Heading for column 1 is Store
Heading for column 2 is Title
Heading for column 3 is Period

The values ​​in column 1 come from storeName
The values ​​in column 2 come from jobShort
The values ​​in column 3 come from the dataRange

dataRange must specify dates in the format DD.MM.YYYY. Present must be translated to Now

The values ​​come from the attached data file.

Example data

[
  {
    "storeName": "Dows",
    "jobShort": "Top boss",
    "dateRange": "Aug 2018 - Present",
    "location": "Copenhagen"
  },
  {
    "storeName": "MMs",
    "jobShort": "Head of money",
    "dateRange": "Jan 2013 - Present",
    "location": "Stockholm"
  },
  {
    "storeName": "KKS",
    "jobShort": "Head of Things",
    "dateRange": "Apr 2011 - Jul 2018",
    "location": "Oslo"
  }
]

Two ways I can think of to approach this:

  • Use a JavaScript column to parse the JSON and output the HTML table. The dates would be a bit fiddly, but other than that it should be pretty straight forward. (ChatGPT would be able to help you).
  • Use a series of Query JSON columns inside a Helper Table to pull the individual values, and then build the HTML with a Template and Joined List. Again, the dates would be a bit fiddly.

Now that I’ve typed that out, I think I’d favour the first option :wink:

2 Likes