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

Subscribe to ScienceAlert's free fact-checked newsletter

Common Supplement Shows a Concerning Link to Heart Failure

Research into a popular sleeping aid has some scientists worried about long-term usage. A recent analysis of adults with insomnia, which has not yet been peer-reviewed, found that people prescribed melatonin for more than a year are at greater risk of heart issues. Among more than 130,000 adults across multiple countries, those who were prescribed

Chris Pratt’s 91% RT Thriller Is Leaving Netflix Very Soon

An acclaimed 2012 political thriller starring Chris Pratt is leaving Netflix in a few weeks. The Oscar-winning film Zero Dark Thirty chronicles the decade-long hunt for al-Qaeda leader Osama bin Laden following the 9/11 attacks, told from the perspective of a fictional CIA intelligence agent. Zero Dark Thirty set to leave Netflix next month Zero

Top celebrity editor, Dan Wakeford, launches newsletter

One of the most experienced celebrity journalists in the biz has launched a newsletter. Dan Wakeford — who has been the boss at People, Us Weekly, and In Touch and Life & Style, as well as the much-discussed Messenger — is going it alone with Celebrity Intelligence. The first issue, out Tuesday, offers an analysis

Bet $5, get $150 in bonus bets for Tuesday’s Premier League matches

Gambling content 21+. The New York Post may receive an affiliate commission if you sign up through our links. Read our editorial standards for more information. The Premier League season is at the top of the stretch, and you can get in on the soccer action by using the bet365 bonus code NYPBET to bet $5 and get

Here’s Why Oracle Stock Got Hammered Last Month

Oracle (ORCL +2.70%) declined 11.7% in March according to data from S&P Global Market Intelligence. The stock is down more than 23% in 2026 as I write. However, the key benchmark date is likely mid-September, when news of the $300 billion deal with OpenAI broke. The initial euphoria over the deal quickly faded, and Oracle’s

Premier League Predictions: Gameweek 29

With 10 gameweeks of the 2025–26 Premier League season remaining, some would suggest that we’ve already ventured into ’run-in’ territory. For those who indulge Scott Hanson and NFL Redzone in football season, the aforementioned final stretch could equate to the “witching hour,” described by Hanson as the period in games “when wins become losses, and

Fragmented Markets Signal Bet Against “Forever War” Scenario

Fragmented Markets Signal Bet Against “Forever War” Scenario

The global market reaction to the escalating conflict in the Middle East remains remarkably fragmented. U.S. equities successfully staged a “buy-the-dip” recovery overnight after an initial selloff. Both S&P 500 and NASDAQ closed with modest gains. In contrast, Asian markets told a darker story. South Korea’s Kospi tumbled nearly -5% as it caught up with

何永賢:簡樸房登記3日收340個分間單位申請  涉110伙  成功登記地址上載專題網站

何永賢:簡樸房登記3日收340個分間單位申請 涉110伙 成功登記地址上載專題網站

房屋局長何永賢今日(3日)表示,簡樸房制度星期日(1日)正式推展,截至今午5時共收到約340個分間單位的登記申請,涉及110個樓宇單位,房屋局分間單位專責小組同事會處理有關申請,檢查所須的資料和文件是否齊備,並在收妥相關資料和文件後,於15個工作天內完成處理,並向申請人發出通知書告知申請結果。成功登記樓宇單位地址將上載至簡樸房專題網站。她今日在社交專頁發文,提到星期日當天局方已循電子途徑收到登記申請,昨日第一個工作天起亦有市民到房屋局分間單位專責小組親身遞交申請表。簡樸房制度下的分間單位登記申請費用全免,完成登記後,有關分間單位可在1年登記期之外,再獲得3年寬限期,前後共4年的過渡時間繼續營運,以處理相關租賃及合規執整。相關登記程序與寬限期詳情,可查閱有關網址:https://www.bhu.gov.hk/tc/regulatory-regime/registration/何永賢周日聯同立法會議員到南昌社區客廳與分間單位租戶座談,宣傳簡樸房制度,及簡約公屋、過渡房屋等改善居住環境的選項與支援。房屋局團隊會持續多渠道、多方式宣傳,讓社會了解分間單位業主或營運人的法律責任,及租戶自身的權益和保障。房屋局轄下6隊區域服務隊也會透過街站、家訪、講座、簡介會等宣傳有關資訊,市民亦可到分間單位區域服務隊資訊平台(https://www.sdu-info.org.hk/tc/landing)了解區域服務隊資訊。她指期待與社會各界攜手一起告別劣質劏房。 Source link

Nory Expands Into U.S. as Restaurants Seek AI Tools to Manage Rising Costs |

Nory’s platform uses historical sales and operational data to generate forecasts and recommendations intended to help operators make more informed decisions about staffing levels, purchasing and day-to-day performance. By Dustin Stone, RTN staff writer – 3.3.2026 As U.S. restaurant operators continue to navigate persistent labor inflation, volatile food costs, and ongoing staffing challenges, technology providers

Real Madrid’s 12 decisive days

Home defeat to Getafe was not in anyone’s plans at Real Madrid. Arbeloa’s arrival on the bench had brought greater consistency, at least in La Liga, and the team managed to wrestle top spot from Barcelona. But in the space of just two rounds, everything has unraveled: Madrid have suffered back-to-back losses – against Osasuna

TARGA ANNOUNCES APPOINTMENT OF BRYCE ROXBURGH TO BOARD OF DIRECTORS AND ISSUES STOCK OPTIONS

CSE: TEX | OTCQB: TRGEF | FRA: V6Y VANCOUVER, BC, March 3, 2026 /CNW/ – Targa Exploration Corp. (CSE: TEX) (FRA: V6Y) (OTCQB: TRGEF) (“Targa” or the “Company“) today announced the appointment of Bryce Roxburgh to its Board of Directors (“Board“), effective immediately, and the issuance of incentive stock options. Mr. Roxburgh brings five decades of

無綫新聞 TVB News

Several Hong Kong tour groups remain stranded in Dubai

發佈日期: 2026-03-03 20:06 TVB News 粵 已複製連結 Disrupted by the Middle East war, several Hong Kong tour groups remain stranded in Dubai. According to some travellers on the ground, the city is largely peaceful for the time being. Amid the escalating regional conflict, many are stuck in the Middle East. Tony, a Hongkonger working in

Fung Wai-kong leaves the force’s headquarters in Wan Chai in June 2021. Photo: Handout

Ex-Apple Daily executive first to appeal sentence in landmark Hong Kong trial

A former Apple Daily senior executive jailed for national security offences in Hong Kong has lodged an appeal against his 10-year term, the first in a landmark trial that saw the founder of the now-defunct tabloid-style newspaper sentenced to 20 years in prison. Court documents reviewed by the South China Morning Post on Tuesday showed

Oscar-Winning Actor’s New Comedy Show Gets Amazing RT Score

Kevin Kline’s latest television project is already drawing significant praise. The Oscar-winning performer leads the new comedy American Classic, which has opened to an impressive score on Rotten Tomatoes. Created by Michael Hoffman and Bob Martin, Season 1 premiered on March 1, 2026.  What the critics are saying about American Classic in reviews American Classic centers on a

What is Trump’s endgame with Iran? | Robert Reich

I’ve spent the last several days checking with foreign policy experts, analysts and specialists in the Middle East for their understanding of Donald Trump’s real goal in Iran, and how anyone (including him) will know he’s achieved it. Several told me that Trump is seeking the kind of “war” that the US executed in Venezuela

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