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

This Insurance Stock Has Quietly Crushed the S&P 500 Over 10 Years

Investors don’t normally look to insurance stocks to beat the market. Sure, there are some tech-focused insurance stocks with high-growth potential, but the old insurance giants don’t typically appear on the radar of growth investors. But these value stocks do offer the stability and strength to outlast riskier stocks and beat the market over the

curved wall and staircase in lobby design Mandarin Oriental

Mandarin Oriental The Landmark, Hong Kong unveils its next chapter • Hotel Designs

Located in the heart of Central, Mandarin Oriental The Landmark, Hong Kong returns with a renewed arrival experience, refreshed rooms and suites, and expanded culinary and wellness offerings, marking a new era for this celebrated Asian property. Reimagined by Hong Kong interior architect Joyce Wang, founder and principal of Joyce Wang Studio, its 109 rooms

Argentina Joins Armenia, Australia, Bahamas, Brazil, Croatia, and More Among Over 170 Countries Enjoying Visa‑Free Travel to Hong Kong (SAR China), Boosting the Region’s Tourism Sector: What You Need to Know

Home » Hong Kong News » Argentina Joins Armenia, Australia, Bahamas, Brazil, Croatia, and More Among Over 170 Countries Enjoying Visa‑Free Travel to Hong Kong (SAR China), Boosting the Region’s Tourism Sector: What You Need to Know Published on April 14, 2026 Image generated with Ai Hong Kong (SAR China) has become even

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)

Aid Groups Use Land Routes to Deliver Humanitarian Relief to Iran

GENEVA, April 14 (Reuters) – International humanitarian groups said on Tuesday ⁠they ⁠had sent emergency relief through ⁠overland routes to Iran, some of their first deliveries of aid since ​U.S.-Israeli strikes began in late February. Aid workers say needs are high in the wake of six weeks ‌of strikes, but stocks of emergency ‌humanitarian supplies

Shanghai Factory Is the Key to Unlocking Robot Mass Production

Elon Musk said Tesla’s (TSLA) Shanghai Gigafactory will play a central role in scaling Optimus robot mass production, a manufacturing facility with a track record of hitting production targets in weeks rather than months. Tesla targets 1 million robots per year from Shanghai, with Gen 3 Optimus volume production planned before the end of 2026,

Discovery Bay developer eyes longer taxi trial amid safety fears

Discovery Bay developer eyes longer taxi trial amid safety fears

The developer of Hong Kong’s Discovery Bay is considering extending its trial period and limiting operating hours for cabbies to gain full access to the resort-style seaside community amid opposition from some residents. The Islands District Council’s Traffic and Transport Committee held a meeting on Tuesday to discuss the paper presented by Hong Kong Resort

Motorola Razr 70 Ultra Specs Leak

Summary created by Smart Answers AI In summary: Tech Advisor reports that Motorola’s upcoming Razr 70 Ultra appears to offer minimal upgrades from its predecessor, similar to Google’s incremental Pixel 10a approach. The device maintains identical dimensions, display sizes, Snapdragon 8 Elite processor, and 50Mp camera system, with only a slightly larger 5,000mAh battery as

Born Again Photos With Huge Spoiler

Mike Colter, who portrays Luke Cage in the Marvel Cinematic Universe projects, has spilled major spoilers for Daredevil: Born Again Season 3 with a recent social media post. Season 2 of the hit TV show is currently airing, and the third chapter is in production. Colter has previously played Luke Cage in Netflix’s eponymous show,

The projected May local election results map for Nuneaton and Bedworth wards, with Reform UK in turquoise blue, according to the Pollcheck website

Reform UK ‘wipeout’ forecast in Nuneaton and Bedworth local elections 2026

Local elections forecast a Reform UK wipeout across Nuneaton and Bedworth. The Pollcheck website projects that Reform will take 14 of the 18 seats that will be up for grabs at the borough council. A colour-coded map of the borough is almost all turquoise with just one forecast seat for Labour, which is red, two

Bitget Launches CFD Copy Trading to Expand Access to Forex, Commodities and Indices

Bitget Launches CFD Copy Trading to Expand Access to Forex, Commodities and Indices

Through USDT-based margin, users can move between crypto, commodities, forex, and indices without transferring funds between external brokers or converting capital across separate platforms. Bitget,  the world’s largest Universal Exchange (UEX), launched CFD Copy Trading, expanding access to traditional financial markets and allowing users to automatically follow professional traders across forex, commodities, and indices directly

Hong Kong insurance complaints body records 857 cases last year, up 33% from 2024

Hong Kong insurance complaints body records 857 cases last year, up 33% from 2024

Hong Kong’s insurance complaints body recorded a 32.7 per cent jump in new cases last year to 857, with medical and travel policies accounting for most of the disputes. The Insurance Claims Complaints Panel under the Insurance Complaints Bureau on Tuesday released the numbers for 2025, which showed that last year’s 857 new complaint cases

Real Madrid-linked defender yet to reach renewal agreement with Premier League giants

According to reports from The Athletic (via AS), discussions over a new deal between Liverpool and Real Madrid target Ibrahima Konate have slowed significantly. In turn, this has created serious uncertainty around the Frenchman’s long-term future at Anfield. Advertisement It must be noted that Liverpool have been engaged in negotiations to tie down one of

Amazon signs $11.57 billion deal for satellite firm Globalstar to challenge Musk’s Starlink

April 14, 2026, 8:20 a.m. ET Amazon.com said on Tuesday it would acquire Globalstar in an $11.57 billion deal, bolstering its fledgling satellite business as it looks to take on bigger rival SpaceX’s Starlink. Shares of satellite company Globalstar were up more than 9% in premarket trading, after gaining over 6% in the past two weeks following media reports of the companies’

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)

Hormuz Mission Talks to Focus on Sanctions, Seafarer Releases, Shipping Readiness – Source

PARIS, April 14 (Reuters) – ⁠Diplomatic ⁠meetings led ⁠by France and Britain ​this week to discuss a ‌potential future multinational ‌mission will be ⁠structured ⁠around a series of working groups, ranging ​from possible sanctions on Iran to cooperation with industry ​to ensure maritime transit, a ⁠person familiar ⁠with the ⁠matter said. According ​to the person,

Hong Kong retiree gets one year in jail for seditious social media comments

Hong Kong retiree gets one year in jail for seditious social media comments

Former salesman Raymond Chong Wai-man, 61, pleaded guilty on Tuesday at West Kowloon Court to knowingly publishing 53 seditious Facebook posts that denigrated the central and local authorities between March 26, 2024 and November 29 last year. Chong, a father of two, drew official ire after commenting on the inferno in Tai Po that engulfed

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