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

Victory Giant joins IPO push by China’s circuit-board makers amid AI frenzy

Victory Giant joins IPO push by China’s circuit-board makers amid AI frenzy

Printed circuit boards (PCBs) – unsung core components in all electronic devices – are emerging as the latest source of excitement in China’s chip supply chain, as domestic companies capitalise on surging global demand for artificial intelligence infrastructure to pursue share listings. Victory Giant Technology, a PCB supplier to US chip champion Nvidia, kicked off

Carney majority prospects and fiscal outlook – TD Securities

TD Securities strategists discuss Canadian by-elections in three federal ridings and notes that Prime Minister Carney’s Liberals are close to securing a majority in Parliament. They highlight that a slim Liberal majority is unlikely to alter the near-term fiscal outlook materially, but it would strengthen Carney’s mandate and lower the probability of a snap election

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)

Social Media Platforms Need to Stop Never-Ending Scrolling, UK’s Starmer Says

LONDON, April 13 (Reuters) – Social media platforms ⁠such ⁠as Instagram and TikTok ⁠need to take action to stop young users ​wasting hours mindlessly scrolling never-ending videos, British Prime Minister Keir Starmer said ‌on Monday. Britain, like other ‌countries https://www.reuters.com/world/asia-pacific/australia-europe-countries-move-curb-childrens-social-media-access-2026-04-08/, is considering restricting access to social media for ⁠children ⁠and it is testing nL1N40C0OY bans,

Hong Kong customs seizes 760 suspected endangered reptiles worth HK$580,000

Hong Kong customs seizes 760 suspected endangered reptiles worth HK$580,000

Hong Kong customs officers have arrested a male driver after intercepting a goods vehicle at the Shenzhen Bay checkpoint and finding 760 suspected endangered reptiles, with an estimated market value of about HK$580,000 (US$74,059), hidden inside. The Customs and Excise Department on Monday said it found 106 turtles and 654 lizards hidden in his truck,

US Stock Market Today S&P 500 Futures Slip As Inflation And Oil Jitters Build

Find winning stocks in any market cycle. Join 7 million investors using Simply Wall St’s investing ideas for FREE. US stock futures are softer this morning, with S&P 500 contracts down about 0.6% as investors react to a jump in energy costs and stronger than expected US inflation. Brent crude sits near US$102 a barrel,

Juventus have already triggered Openda obligation despite 5 consecutive snubs

Reports in Italy confirm that Juventus have triggered their obligation to buy for attacker Lois Openda, despite the fact that the Belgian has been left as an unused substitute for the last five rounds of Serie A fixtures. How much will Juventus have to pay after triggering Openda obligation to buy? Openda joined Juventus on

The South Korean star who caused outrage by eliminating Italy from the World Cup

FRANKFURT, GERMANY – JUNE 13: Jung-Hwan Ahn of South Korea shoots on goal during the FIFA World Cup Germany 2006 Group G match between South Korea and Togo at the Stadium Frankfurt on June 13, 2006 in Frankfurt, Germany. (Photo by Laurence Griffiths/Getty Images) Ahn Jung-hwan was the first South Korea international to play

‘Common ignorance’: how China took the lead in global efforts to govern AI’s future

‘Common ignorance’: how China took the lead in global efforts to govern AI’s future

Governments, industry and the public are in “common ignorance” about the present and future of artificial intelligence, making both international collaboration and coordination between industry and policymakers necessary, experts have said. In a panel discussion at the inaugural Hong Kong Global AI Conference at the University of Hong Kong (HKU) on Saturday, Alibaba Group Holding

“I’d have one tomorrow”: Is Jeff Bezos’ wife Lauren Sánchez expecting a baby soon?

Jeff Bezos’ wife Lauren Sánchez Lauren Sánchez isn’t just the glamorous wife of Amazon billionaire Jeff Bezos—she’s a licensed pilot, ex-journalist, philanthropist, and founder of Black Ops Aviation, her high-flying film production company. Yet, at 56, she’s making headlines for her unfiltered enthusiasm about expanding their blended family of seven. In a candid New York

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)

Turkey Concerned About Any New Iran-US Rules for Strait of Hormuz

ANKARA, April 13 (Reuters) – Turkey’s foreign minister raised ⁠concerns ⁠on Monday about Iran ⁠or the United States proposing any new regulations for ​transiting the Strait of Hormuz, and said he saw difficulties around proposals to re-open ‌the waterway with an international ‌force.  Foreign Minister Hakan Fidan – who is in close touch with the

EV market finds footing after steep post-incentive decline

U.S. EV demand cools after tax credit expiration, but quarterly trends suggest the market may be finding a floor. On the Dash: EV demand is stabilizing, not rebounding, with sales likely to remain flat in the near term Incentive-driven volatility highlights the importance of pricing strategy and inventory discipline Long-term EV growth will depend on

Euphoria Season 3 Soundtrack & All Songs in Episode 1 Listed

Euphoria season 3 has finally premiered after years of anticipation. The third season of the Sam Levinson show, which also serves as the final one in the saga, released its first episode on April 12, 2026. There are already many elements to love in Euphoria season 3, including its soundtrack, which seems to have impressed

EUR/CHF Daily Outlook - ActionForex

EUR/CHF Daily Outlook – ActionForex

Daily Pivots: (S1) 0.9226; (P) 0.9243; (R1) 0.9268; More…. Intraday bias in EUR/CHF remains neutral and consolidations from 0.9264 could extend. Further rise is expected with 0.9155 support intact. Firm break of 0.9264 will resume the rebound from 0.8979 to 0.9394 resistance next. However, break of 0.9155 will turn bias back to the downside for

A still from Mabel Cheung’s documentary “To My Nineteen-Year-Old Self”. Photo: Handout

Hong Kong school hits back at filmmaker in row over Italian festival screening

The supervisor of a prestigious secondary school in Hong Kong has hit back at the director and distributor of a controversial coming-of-age documentary, accusing them of “defaming” the integrity of the institution’s principal and placing her in an “unjust position”. The claims, contained in a letter sent to students of Ying Wa Girls’ School on

US Stock Market Today: S&P 500 Futures Slip As Inflation And Energy Worries Build

The Morning Bull – US Market Morning Update Monday, Apr, 13 2026 US stock futures are pointing lower this morning, with E-mini S&P 500 contracts down about 0.6% and Nasdaq 100 futures weaker by roughly 0.7%, as investors react to a fresh inflation shock and higher energy costs. March US consumer prices rose 0.9% month

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)

Venezuela Hopes to Lure Back International Miners, but It’s a Risky Business

By Maria de los Angeles Ramirez PUERTO ORDAZ, Venezuela, April 13 (Reuters) – Venezuela’s https://www.reuters.com/world/venezuela/ effort to attract foreign investors to develop its gold, iron and bauxite seams has ⁠enthusiastic backing ⁠from the Trump administration but faces big challenges, including armed groups with deep interests in ⁠the chaotic, largely illegal prospecting industry that has developed

Heidenheim’s Frank Schmidt on his team’s final top flight days: “The Bundesliga must be celebrated!”

Regular contributors Benedikt Gimber, Arijon Ibrahimovic, Hennes Behrens, Jonas Föhrenbach, and Mikkel Kaufman were unable to train regularly with the team this week. Striker Kaufmann will definitely miss the weekend match against Union Berlin. At his Friday pre-match press conference, Schmidt confirmed that wide man Sirlord Conteh is due for season ending knee surgery.  Heidenheim

Mbappé overshadows Vinícius’s best performance

According to Spanish newspaper Sport, Vinicius has rediscovered his form while French teammate Kylian Mbappé is sidelined. According to the Spanish daily, the Brazilian star has rediscovered his best form and now feels as indispensable as he did before Mbappé’s arrival. With manager Álvaro Arbeloa’s full backing, the forward has become Real Madrid’s top scorer

Firefighters prioritised tackling blaze over rescues, Tai Po probe hears

Firefighters prioritised tackling blaze over rescues, Tai Po probe hears

Firefighters combating Hong Kong’s deadliest fire in decades prioritised bringing the blaze under control over evacuating residents due to the “unprecedented” scale of the disaster, a public inquiry has heard. Four Fire Services Department officers on Monday shared how the operation unfolded during the initial stage of the 43-hour inferno that ravaged Wang Fuk Court

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