The HTML form to structured data pattern


This week I received a lot of submissions to airportpianos.org, the index of pianos in airports that I maintain. Submissions come through a Google Form. The form is intentionally brief , asking for two pieces of information: the airport name and the location of the piano.

When I receive a submission, I fill out a JSON entry and add it to the list of pianos. This list is then used to generate the static airportpianos.org web site. You can see the raw data used to generate the site on GitHub.

I regularly make small errors when adding new entries by hand. The most common one is adding a comma to the end of a JSON entry — which you can’t do! — or forgetting a comma after a value where one is needed.

This week I created a web form that generates the JSON record for me. The form is a static HTML page. When you submit the form, a JavaScript script reads the contents of the form fields and generates the JSON record that I can then paste into the list.

A section of the Add a Piano admin form showing several form fields, including the airport name, IATA code, and city where the airport is located

The form has a few addiitonal features. FIrst, if I type an IATA code — an “airport code” — that is already listed on the site, I get a warning to tell me the entry already exists. This will prevent me from making duplicate entries, and make sure I go to check the existing information to make sure it matches the most recent submission for the airport piano.

Second, I added two links:

  • Search for IATA
  • Search for lat long

The former takes the name of the airport and creates a Google Search link for {airport name} airport code. Google usually returns a big box showing the airport code, which makes data entry easier for me. The same is true of latitude and longitude, too.

A big results box on Google Search showing the airport code for Edinburgh Airport, EDI

Here is an example of a final record generated by the web form:

{
    "iata": "CPH",
    "title": "Copenhagen Kastrup International Airport",
    "city": "Copenhagen",
    "state": "Copenhagen",
    "country": "Denmark",
    "lat": "55.6120",
    "long": "12.6477",
    "zoom": "12",
    "hasPiano": "true",
    "pianoShortLocation": "Terminal 3",
    "lastConfirmed": "2025",
    "description": "There is a piano for public use located at Terminal 3.",
    "slug": "cph"
}

The record is valid JSON that I can add to the list of pianos.

This implementation follows the same principles behind my publish tool that I use to publish blog posts on my site: create a web form that, with JavaScript, generates data in the structure that a static site generator expects.



Source link

Visited 1 times, 1 visit(s) today

Related Article

Trump fails to bully Supreme Court on birthright citizenship

April 4, 2026, 4:01 a.m. ET On April 1, the Supreme Court heard oral arguments on the Trump administration’s reinterpretation of birthright citizenship, and it became clear that the justices, per usual, would not be swayed by outside pressures. Every justice on the court expressed some level of skepticism about the administration’s position.  In this

Decisive month ahead for French international as Real Madrid eye key titles

Following the conclusion of the final international break of the season, Real Madrid are set to resume their campaign this weekend, when they take on Mallorca. It promises to be an important game for Kylian Mbappe, who hasn’t really been involved in the team’s success story in the past month or so, owing to injuries.

A once-in-a-decade chance to buy this S&P 500 stock?

Image source: Getty Images The S&P 500’s tech stocks have dramatically fallen out of favour with the stock market this year. And the main reason is artificial intelligence (AI). AI looks like it’s here to stay, but investors don’t know what to make of it. That’s why share prices have been falling – and I’m

Thousands of Hongkongers brave heavy rain for Shenzhen trip on day 2 of Easter

Thousands of Hongkongers brave heavy rain for Shenzhen trip on day 2 of Easter

Thousands of Hongkongers braced for heavy rain as they crossed the border into Shenzhen on the second day of the Easter holiday, taking advantage of the break to enjoy a wider range of shopping, dining and entertainment options at bargain prices. Many travellers on Saturday cited mainland China’s broader selection of shopping centres, restaurants and

High Potential Season 2 Episode 18 Release Date, Time, Where to Watch

The High Potential Season 2 Episode 18 release date and time is approaching swiftly. Titled “Family Tree,” it serves as the sophomore installment’s finale. In the episode, a woman winds up dead at the luxury hotel where Lucia works, making things complicated for both Morgan and Karadec, who investigate the murder case. Meanwhile, Ava deals

Uli Hoeneß advocates for eradicating 50+1 rule from German football

The Bundesliga has had a big cash problem over the last years, seeing their financial power left behind in the dust by leagues such as the Premier League or La Liga. This has left the league searching for solutions to stop eating so much dust and close that gap. One of the easiest way the

The war in Iran: is Trump ‘on the run’?

As Donald Trump’s war wears on, it becomes increasingly clear that he has no “overarching strategy” and is now fighting a war of attrition, said The Guardian. America is still striking at Iranian targets while building up troops in the region. Iran, in turn, keeps attacking Israel and the Gulf states. Last week, it hit

Easter break: Travelers pack ports

Easter break: Travelers pack ports

Travelers wait for high-speed trains at Hong Kong West Kowloon Station on April 4, 2026 morning, the second day of the five-day Easter break. (SHADOW LI / CHINA DAILY) Hong Kong’s airport, West Kowloon Station and other key ports buzzed with crowds of travelers as the city went into a five-day break for the Easter

US Dollar Forecast: DXY Gains on War Risks Before U.S. Jobs Report

Subscribe To Notifications Scan QR code to install app Important DisclaimersFXEmpire is owned and operated by Empire Media Network LTD., Company Registration Number 514641786, registered at 7 Jabotinsky Road, Ramat Gan 5252007, Israel. The content provided on this website includes general news and publications, our personal analysis and opinions, and materials provided by third parties.

Atletico Madrid: What next for manager Diego Simeone?

One thing that is indisputable is Simeone’s managerial record at Atletico. He has taken charge of Atletico Madrid on 786 occasions, recording 465 wins, 170 draws and 151 defeats across more than 14 and a half seasons at the helm. It makes him one of the longest-serving managers in world football. Atletico offered Simeone his

Could Investing $10,000 in SPYM Make You a Millionaire?

The stock market has delivered 10% average annual returns for the past 50 years. And when we say, “the stock market,” we are talking about the S&P 500 index — the 500 largest publicly traded stocks in America. If you want an easy way to buy the S&P 500 index while saving money on fees,

A vibrant, abstract painting depicting a Panama-flagged cargo ship in motion, with the ship's form repeated in overlapping, fractured geometric shapes in shades of blue, conveying a sense of disruption and geopolitical tension.

U.S. Accuses China of Bullying Over Panama Ship Detentions

Got story updates? Submit your updates here. › Tensions escalate as China’s detention of Panama-flagged ships threatens global trade and regional sovereignty.Washington Today U.S. Secretary of State Marco Rubio has accused the Chinese government of using economic pressure tactics after dozens of Panama-flagged vessels were detained or delayed at Chinese ports, raising concerns about global

A satellite image shows Bab el-Mandeb Strait off the coast of Yemen, February 27, 2026. (via REUTERS)

Iran eyeing Bab el-Mandeb strait after Hormuz? Top official drops big hint

Amid ongoing disruptions in the Strait of Hormuz, Iran has signalled expanding focus to another key global shipping route, the Bab el-Mandeb or Bab al-Mandab strait, heightening concerns over supply chains and energy flows. A satellite image shows Bab el-Mandeb Strait off the coast of Yemen, February 27, 2026. (via REUTERS) The remarks by Iranian

As Jeff Bezos ‘celebrates’ post on first-ever purchase made on Amazon, Elon Musk replies, says: It was start of …

Jon Erlichman, BNN Bloomberg contributor and the host of Ticker Take, a YouTube channel dedicated to investing and financial literacy recently shared photos of Amazon’s first non-employee purchase. The X post included original packing slip and Douglas Hofstadter’s “Fluid Concepts and Creative Analogies,” a book exploring AI and computer models of thought. “On this day

Rising oil prices linked to the Iran war are driving up the cost of plastic production. (Getty Images via AFP)

How US-Iran war has disrupted plastic and glass supply chains

The US-Iran war in West Asia has not just caused an oil and gas supply crisis and sent energy prices soaring amid a near closure of the Strait of Hormuz, but it has also affected items products made from plastic and glass. The conflict has unsettled the global plastics and glass market, as disruptions in

How to watch Man City vs Liverpool: TV channel and live stream for FA Cup today

Manchester City take on Liverpool in a blockbuster FA Cup quarter-final tie this weekend. Pep Guardiola’s men are looking to win another piece of silverware this season after beating Arsenal 2-0 in the Carabao Cup final last month. Advertisement They sit second in the Premier League table, nine points adrift of the Gunners at the

0
Would love your thoughts, please comment.x
()
x