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

Napoli 0-2 Lazio – Conte: ‘De Laurentiis can say what he wants, today was a kick to the teeth’

Antonio Conte delivered one of his more revealing post-match addresses after Napoli’s chastening home defeat to Lazio, accepting responsibility for failing to read his squad’s deteriorating condition while firing a pointed but carefully measured response at president Aurelio De Laurentiis over public comments about his future. Read Football Italia Ad-Free and get access to Exclusive

Jim Cramer Says Madison Air (MAIR) “Can Be Bought Right Here, Right Now”

Madison Air Solutions Corporation (NYSE:MAIR) was among Jim Cramer’s stock calls, as he discussed the rising market speculation. Discussing MAIR’s recent IPO, Cramer said: With the market now fully recovered from its Iran-related weakness and back to setting fresh all-time highs, it makes sense that the IPO window would open again. And sure enough, today

2025 China & Global Development Reports Published in Hainan

HAIKOU, China, April 18, 2026 /PRNewswire/ — A report from the Hainan International Media Center: The newly published 2025 China & Global Development Reports were unveiled at the event. In Haikou on April 16th, during the 6th China International Consumer Products Expo, a book launch event was held to celebrate the publication of the China Development

NBA Playoffs Prediction Market Apps: Get Top Offers for First Round Games

Photo Credit: Craig Dudek Photo Credit: Craig Dudek This article contains references to products from our advertisers and/or partners, and… Photo Credit: Craig Dudek Photo Credit: Craig Dudek This article contains references to products from our advertisers and/or partners, and we may receive compensation when you click on links to products and services There is

China offers loans, technology for Vietnam railways

China offers loans, technology for Vietnam railways

China-Vietnam railway ties were in focus on Friday as President To Lam concluded his visit. Beijing offered loans, technology and training for Vietnam’s rail infrastructure development. The visit also included high-speed train journeys across China’s north and southwest. This is reported by the railway transport news portal Railway Supply. China offers loans, technology for Vietnam

Nicolas Cage’s Widely Acclaimed 2021 Thriller Is Leaving Netflix 

Pig, the critically acclaimed thriller starring Nicolas Cage, is set to leave Netflix next month. Written and directed by Michael Sarnoski, the film first arrived in U.S. theaters on July 16, 2021, earning strong praise from both critics and audiences. Its upcoming exit from the platform brings attention back to the well-received film. Pig is

GBP/JPY Weekly Outlook - ActionForex

GBP/JPY Weekly Outlook – ActionForex

GBP/JPY’s pullback from 125.89 accelerated lower last week, but downside is contained above 213.29 resistance turned support. Initial bias stays neutral this week first. Firm break of 215.89 will resume larger up trend to 61.8% projection of 199.04 to 214.98 from 209.58 at 219.43. In the bigger picture, up trend from 123.94 (2020 low) is

Why I Love This Dividend Stock and Its 6% Yield

With the market reaching all-time highs and many growth stocks’ valuations looking stretched, some investors may be looking to bolster their portfolios with more substance. Companies with resilient cash flows and a substantial dividend yield can be a great way to anchor a portfolio. And that brings me to Verizon (VZ 0.40%). Sure, the telecom

Serie A official line-ups: Roma vs. Atalanta

Roma and Atalanta go head-to-head for European ambitions, as emotional Gian Piero Gasperini faces his past with Donyell Malen and Matias Soulé, while Charles De Ketelaere and Giacomo Raspadori start It kicks off at the Stadio Olimpico in Rome at 19.45 UK time (20.45 CEST). Advertisement You can follow all the build-up and action as

Trial against Pedro Sánchez's wife clouds tour to China

Trial against Pedro Sánchez’s wife clouds tour to China

This week, the president of the Spanish Government, the socialist Pedro Sánchez, arrived in Beijing with the intention of projecting Spain as Europe’s pragmatic bridge to China. However, the trip was overshadowed by a judicial setback in his country: a Madrid judge ordered the prosecution of his wife, Begoña Gómez, for alleged influence peddling, embezzlement,

Trump signs executive order on psychedelic drugs — with Joe Rogan by his side

Joe Rogan truly had President Donald Trump’s back on Saturday. The world’s No. 1 bro-caster, who has expressed some buyer’s remorse over his endorsement of Trump, stood directly behind the president, who was seated at the Resolute Desk in the Oval Office signing an executive order to ease restrictions on medical research and treatments using

Why Barcelona, Real Madrid Aren’t Playing This Weekend

Only seven games remain in the 2025–26 La Liga season, with bitter rivals Barcelona and Real Madrid once again headlining the title race, one that will have to wait a little longer to resume. Barcelona hold a nine-point advantage over Real Madrid at the summit after Los Blancos’ underwhelming draw against Girona allowed Barça to

Seagulls are pictured at the Baltic Sea beach in Timmendorfer Strand, Germany, on a sunny Sunday, April 12, 2026. (AP Photo/Michael Probst)

Iran Says No Date Set for Next Round of Negotiations With US

ANTALYA, Turkey, April 18 (Reuters) – No date ⁠has ⁠been set for the next ⁠round of negotiations between Iran and the United States, Iran’s deputy foreign ​minister said on Saturday, adding that a framework of understanding must be agreed first. The highest-level U.S.-Iran ‌talks since the 1979 Islamic Revolution ‌ended in Islamabad without agreement last weekend.

Top 5 AI Stocks Under $200

While fractional shares are becoming more common, removing the barrier to entry to many leading stocks, not every investor has access to them. As a result, looking at reasonably priced stocks becomes part of the artificial intelligence (AI) investing strategy. If you’ve only got $200 to spend on a stock and have to buy a

Seagulls are pictured at the Baltic Sea beach in Timmendorfer Strand, Germany, on a sunny Sunday, April 12, 2026. (AP Photo/Michael Probst)

Mexico Mends Ties With Spain in First Presidential Visit in Eight Years

By Aida Pelaez-Fernandez and Joan Faus BARCELONA, April 18 (Reuters) – Mexican ⁠President ⁠Claudia Sheinbaum and Spain’s Pedro ⁠Sanchez met in Barcelona on Saturday after a summit of progressive leaders, signaling ​a rapprochement during the first presidential visit to the Mediterranean country in eight years. The meeting took place during ‌Sheinbaum’s visit to Barcelona to

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