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

Warren Buffett’s Berkshire Hathaway Is Doubling Its Money in Coca-Cola, American Express, and Moody’s Every 21 to 30 Months — Here’s How

Before retiring as CEO on Dec. 31, billionaire Warren Buffett had the pleasure of seeing the company he and now-late right-hand man Charlie Munger had built, Berkshire Hathaway (BRKA 0.52%)(BRKB 0.62%), reach the trillion-dollar plateau. While Berkshire’s former boss acquired roughly five dozen businesses spanning more than half a century, it’s his investing prowess that

The photovoltaic, energy storage, and new energy sectors in the Hong Kong stock market have shown strong performance against the trend as the industry enters its traditional peak season with tightening supply and demand.

① Which individual stocks in the Hong Kong stock market’s photovoltaic energy storage and new energy sector are receiving capital inflows despite the adverse market trend? ② With the industry entering its traditional peak season and supply-demand dynamics tightening, how do institutions view subsequent opportunities? Cailian Press report on March 20 (Editor: Feng Yi) –

Alibaba workforce shrinks 34% in 2025 as Chinese tech giant doubles down on AI

The Alibaba stand at the World Artificial Intelligence Conference at the Shanghai World Expo Exhibition Center in Shanghai, China, on July 5, 2024. Nurphoto | Nurphoto | Getty Images Alibaba‘s workforce shrank by roughly 34% over the course of 2025, as the company offloaded some of its offline retail businesses while doubling down on artificial

Bayern Munich U19’s Sadiki Chemwor leaves for Eintracht Frankfurt

Sadiki Chemwor joined Bayern Munich from TSV Milbertshofen at the age of eight and has spent a decade at the club, rising through the club’s youth ranks. But the journey at Bayern has now ended, as Eintracht Frankfurt’s official English website announced Die Adler’s capture of the skillful wide player on a free transfer upon

St. Kitts Deepens Its Travel Industry Presence in the United Kingdom With High-Impact Tourism Initiatives and What It Means for International Travelers Planning Caribbean Getaways

Home » TOURISM NEWS » St. Kitts Deepens Its Travel Industry Presence in the United Kingdom With High-Impact Tourism Initiatives and What It Means for International Travelers Planning Caribbean Getaways Published on March 20, 2026 Image generated with Ai The Caribbean island of St. Kitts is intensifying its global tourism push, as demonstrated by a

Fresh watercress in bamboo basket

The cheap UK superfood named the ‘world’s healthiest food’

With spring just around the corner, a leafy green superfood is about to come into season — and it’s one of the most nutritious foods you can add to your plate right now. But don’t just take our word for it. As well as being a seasonal April veggie and costing less than £2 a

Piers Morgan Walks Off Hstikkytokky Interview: ‘F—ing Idiot’

Piers Morgan and HSTikkyTokky interview quickly turned into chaos. What started as a sit-down discussion ended with Morgan walking off set. Piers Morgan storms off after Hstikkytokky interview Piers Morgan agreed to interview controversial influencer Harrison Sullivan, better known as HSTikkyTokky, following his appearance in Louis Theroux’s Netflix documentary, Inside the Manosphere. Morgan questioned him

Long before Trump: How US policy has harmed the environment for decades | Climate Crisis News

Health and environment advocacy groups in the United States are suing the Environmental Protection Agency (EPA) over the Trump administration’s decision to withdraw a key 2009 climate change ruling known as the “endangerment finding”. That finding had established that greenhouse gases are a risk to public health and environmental safety, given that they are the

Iran war puts listings on hold

The National Stock Exchange (NSE) building in Mumbai, India, on Wednesday, Dec. 10, 2025. Dhiraj Singh | Bloomberg | Getty Images Global volatility is threatening a pipeline of multibillion-dollar stock market listings in India, the world’s busiest IPO market. Payments app PhonePe’s move on Monday to halt its listing plans has underscored a growing strain

‘Sports and entertainment combine to boost economy’

Representatives from the sports sector are optimistic about Hong Kong’s growing sports scene, with many highlighting the potential of combining athletics with entertainment to boost the city’s global image and economic vitality. Kenneth Fok, vice-president of the Sports Federation and Olympic Committee of Hong Kong, China, expressed hope for a stronger event economy, especially with

Latest and Breaking News on NDTV

Arrested US Mercenary Matthew VanDyke Explains How He Recruits Warfighters

New Delhi: American national Matthew Aaron VanDyke, who is in Indian custody and faces charges of illegally entering India to go to Myanmar for training ethnic insurgents, has left behind a large digital footprint going back over a decade. In one of them, he explained how he recruited “fighters” to be sent to wars across

Chinese Founder of router-maker TP-Link to Federal agencies: Our CEO and his wife are becoming US citizens under Trump Gold Card program

Chinese Founder of router-maker TP-Link to Federal agencies: Our CEO and his wife are becoming US citizens under Trump Gold Card program

Amid rising scrutiny, TP-Link’s CEO Jeffrey Chao is applying for U.S. permanent residency via a $1 million visa program, a move that coincides with ongoing federal investigations into his firm. The investigations, conducted by the Commerce, Justice, and FTC departments, are fueled by worries that Chinese authorities might pressure TP-Link to support cyber threats. Jeffrey

Exclusive: Barcelona determine their jersey for retro matchday in La Liga

La Liga is preparing to roll out something never seen before in Spanish football, a full-scale retro-themed matchday that taps into nostalgia and club identity. Across the weekend of April 10 to 13, clubs from both the first and second divisions will step onto the pitch wearing kits inspired by iconic designs from their past,

Neurodiverse workers could thrive in AI economy, says CareLineLive founder

Neurodiverse workers could hold a distinct advantage as artificial intelligence reshapes the modern workplace, according to a UK technology entrepreneur who says businesses are overlooking a critical talent pool at a pivotal moment of change. Josh Hough, founder of home care software firm CareLineLive, has argued that traits commonly associated with neurodiversity, including heightened focus,

supermicro headquarters

Supermicro executives charged in $2.5B AI smuggling scheme to China

NEWYou can now listen to Fox News articles! Federal prosecutors charged three men linked to Super Micro Computer Inc. in a sweeping scheme to smuggle billions of dollars in U.S. artificial intelligence technology to China using fake documents, shell companies and staged equipment, officials said. The defendants allegedly diverted $2.5 billion worth of AI servers

Donald Trump looking serious and sitting at a desk.

Trump has postponed his meeting with Xi, but China is not wasting any time on it

For months behind the scenes in Beijing, Chinese and American officials have been locked in negotiations over one of the most consequential political meetings of this year.  China’s President Xi Jinping was set to host United States President Donald Trump at a highly choreographed reception in Beijing at the end of March. Iran war live

Hong Kong crane collapse signals need for metal fatigue testing: expert

Hong Kong crane collapse signals need for metal fatigue testing: expert

Hong Kong should review its crane safety guidelines to include mandatory testing for metal fatigue, an industry expert has said after the city recorded another fatal case involving a collapse. An operator was killed on Thursday afternoon when a tower crane fell at a construction site for the second phase of a public housing project

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