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

Gemini can now draw on your Google data to personalize the images it generates

Your Google Photos library could soon influence the kind of images you can generate with Gemini. After letting users personalize the AI assistant’s responses with data from Gmail, Search and YouTube, Google says it’s bringing that same “Personal Intelligence” to Nano Banana 2 to make it easier for users to create personalized images with the

Hong Kong leader John Lee, EU officials meet to discuss trade, cooperation

Hong Kong leader John Lee, EU officials meet to discuss trade, cooperation

Hong Kong leader John Lee Ka-chiu has met European Union representatives to discuss opportunities for cooperation, with the chief executive saying both sides highlighted a shared belief in multilateralism amid increasing tensions and market turmoil. Ambassador Harvey Rouse, head of the EU Office in Hong Kong, called for both sides to work together, describing the

Hit Fox TV Show’s Latest Season Premieres on Hulu Today

One of Fox‘s long-running TV shows has finally returned with an exciting all-new season, five months after wrapping up its last installment. Beginning today, Hulu subscribers can now watch the first episode of Gordon Ramsay‘s MasterChef Season 16. What do we know about MasterChef Season 16? Following last season’s Dynamic Duos theme, the newest installment

Elior Manier - Picture

The US Dollar is stalls as the world awaits Ceasefire news – DXY Outlook

Elior Manier Market Analyst Elior brings over seven years of experience in financial markets to our analyst team. Since 2018, he has actively engaged in observing, charting, and trading, driven by his passion for mastering market dynamics. With a profound understanding of the geopolitical and macroeconomic forces that shape market movements, Elior focuses on analysing

Why Are More and More Celebrities Becoming Death Doulas? Its Popularity, Explained

When the Tony-winning Broadway star Gavin Creel was diagnosed with a rare and aggressive form of cancer, he asked his best friend, fellow Tony-winning actor Celia Keenan-Bolger, to become his end-of-life doula. Creel was diagnosed with metastatic melanotic peripheral nerve sheath sarcoma in July 2024, and he died two months later, at 48, to the

Beijing’s point man on Hong Kong affairs meets city’s leaders in capital

Beijing’s point man on Hong Kong affairs meets city’s leaders in capital

Beijing’s point man on Hong Kong affairs has met the city’s No 2 official and finance chief in the capital to discuss alignment with the national 15th five-year plan, as the city government prepares to draw up its own inaugural blueprint by the end of the year. The State Council’s Hong Kong and Macau Affairs

Why Did Planet Labs Stock Pop Today?

Planet Labs (PL +12.00%) stock jumped 10.5% through 10 a.m. ET this morning — for no obvious reason. No upgrades from Wall Street, nor even a change in price target. In fact, the closest thing to “news” about this satellite stock… might even be bad news. Image source: Getty Images. Look who’s selling Planet stock

Chivu explains Bastoni omission in Inter’s game vs. Cagliari

Inter coach Cristian Chivu says Alessandro Bastoni won’t be available for tomorrow’s Serie A match against Cagliari: ‘He’s not well.’ Inter will be forced to cope without their star defender Bastoni in Friday’s Serie A match against Cagliari at the Stadio Meazza. Advertisement Chivu confirmed the Italian defender’s omission during a press conference on Thursday.

Premier League winning goalkeeper Alex Manninger killed in car accident

Former Austria goalkeeper Alex Manninger, who played for Arsenal and a string of Italian clubs, died in a road accident on Thursday aged 48, the Austrian Football Association (OEFB) said. The Kronen Zeitung and other media reported that Manninger’s vehicle was hit by a passenger train at an unrestricted crossing near the Austrian city of

Hong Kong government forks out two-thirds of HK$90 million tab for HK$2 fare revamp

Hong Kong government forks out two-thirds of HK$90 million tab for HK$2 fare revamp

The revamp to Hong Kong’s HK$2 (26 US cents) transport fare concession scheme for the elderly and disabled carried a HK$90 million price tag, with the government paying two-thirds, a Legislative Council finance committee paper revealed on Wednesday. It also showed that about 220 beneficiaries averaged more than 240 trips a month – equivalent to

Etihad Airways makes flying with pets cheaper with a new offer

Your pet can now fly with you as Etihad Airways drops its onboard fee to $399 for a limited time For anyone who hates leaving their pet behind at the airport goodbye gate, this one feels personal. Etihad Airways has just made it easier and cheaper to fly with your cat or dog, rolling out

Elon Musk confirms progress on AI6, Dojo3 systems

Elon Musk took to his social media platform X to congratulate his Tesla team for their work on the AI5 chip. His post read: “Congrats to the @Tesla_AI chip design team on taping out AI5! AI6, Dojo3 & other exciting chips in work.” Tesla’s AI5 chip, also known as Hardware 5, is the company’s next-generation

A devotee dressed as a townsperson takes part in a Way of the Cross reenactment in Arraijan, Panama, Good Friday, April 3, 2026. (AP Photo/Matias Delacroix)

Switch off and Read, France’s Macron Tells Teenagers

By Michaela Cabrera and Daria Sito-Sucic VILLERS-COTTERETS, France, April 16 (Reuters) – French President Emmanuel Macron urged high ⁠school ⁠pupils on Thursday to switch off their phones ⁠and read, pushing for one “no screens day” per month for all, and a blanket social media ban for those under ​15 years of age. Following Australia’s groundbreaking

Hong Kong’s Hospital Authority bars all contractors’ access to data after leak

Hong Kong’s Hospital Authority bars all contractors’ access to data after leak

Hong Kong’s Hospital Authority has suspended all contractors’ access to patient data after a major leak affecting more than 56,000 patients, and is considering barring the company involved from bidding for future projects. But the authority on Thursday declined to say whether it would terminate the firm’s existing contracts or discipline any staff, citing an

Guideline Launches KPI Forecast 2.0, Delivering Advanced Ticker-Level Forecasting for Capital Markets

New offering leverages proprietary ad spend data to provide high-precision, data science-driven revenue modeling to assist forecasting for institutional investors including hedge funds, mutual funds, and quantitative fund managers NEW YORK, April 16, 2026 /PRNewswire/ — Guideline today announced the launch of KPI Forecast 2.0, an enhanced analytics solution designed to help institutional investors and financial

Malagò declines Allegri comment, hints at ex-Italy player in FIGC Presidential race

Giovanni Malagò, one of the likely candidates in the FIGC Presidential elections, hints at the involvement of a former Italian player in his project but refuses to answer a question about Massimiliano Allegri. Malagò and Giancarlo Abete are expected to be the only candidates in the FIGC Presidential elections on June 22. Advertisement Malagò has

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