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

輝達股東請放心!祖克柏開金口預測AI前景:2026年將大幅加速

記者鄧天心/綜合報導 隨著美股財報季火熱展開,全球投資人的目光再度鎖定在AI晶片霸主輝達(Nvidia)身上,過去五年股價狂飆1300%,營收屢創新高,然而,市場最擔心的問題始終是「這波漲勢還能持續多久?」對此,Meta執行長祖克柏(Mark Zuckerberg)近期的一席話,或許為輝達的多頭走勢打了一劑強心針。 祖克柏預告的未來對輝達是利多。(圖/123RF) 延伸閱讀: 受夠ChatGPT的拍馬屁?教一招打「馬鈴薯」AI給你更真實、毒蛇的回覆! 身為輝達的大客戶,Meta的動向往往被視為AI硬體需求的風向球,祖克柏在上週的財報法說會中直言:「我們正目睹AI發展大幅加速,我預期2026年這股浪潮將在多個層面進一步擴大。」他強調2026年將是「打造未來基礎建設的關鍵年」。 Meta受惠於社群軟體(Facebook、Instagram)廣告營收強勁,Meta上季營收成長24%來到590億美元,滿手的現金意味著Meta有足夠的銀彈繼續投資AI軍備競賽,這對輝達來說無疑是最大的利多。 祖克柏的談話暗示了輝達產品的需求將從早期的模型訓練延伸至更廣泛的日常推論應用,近期許多企業開始將AI平台導入實際解決複雜問題,對GPU的依賴只會增不減,此外,輝達預計在今年稍晚推出新一代Rubin平台,這將成為推動營收成長的另一個強大動力,祖克柏的預測證實了AI基礎建設週期遠未結束。對於輝達持有者來說,這無疑是一顆定心丸;但對於觀望者而言,AI浪潮下的硬體需求,顯然還有很長一段路要走。 資料來源:The Motley Fool

Serie A | Parma 1-4 Juventus: Bremer impressive with rare double

PARMA, ITALY – FEBRUARY 01: Bremer of Juventus scores his team’s third goal during the Serie A match between Parma Calcio 1913 and Juventus FC at Stadio Ennio Tardini on February 01, 2026 in Parma, Italy. (Photo by Alessandro Sabattini/Getty Images) Juventus celebrated a rare Gleison Bremer brace, along with Weston McKennie and Jonathan

Here’s why I’m not panicking about a stock market crash in February

Image source: Getty Images Will we see a stock market crash this month? It’s always possible. Shares can crash at any time, so it makes sense to be prepared. Sometimes, a crash comes out of the blue. That’s pretty much what happened on Black Monday in 1987, when automated trading strategies turned a dip into

Lunch at Duddells

Architect André Fu’s insider guide to Hong Kong

Lunch at Duddell’s Duddell’s Dim sum at Duddell’s “I recently helped to renovate Duddell’s in Central, a one-Michelin-starred restaurant with a really fun dim-sum brunch. We took cues from Lingnan architecture for the design, reflecting Hong Kong as a place where different cultures are juxtaposed together. It’s part of an art and culture that is

Bellingham suffers hamstring injury as Real Madrid scrape past Rayo Vallecano

Real Madrid’s Jude Bellingham reacts in pain during the Spanish La Liga soccer match between Real Madrid and Rayo Vallecano in Madrid, Spain, Feb 1, 2026. (PHOTO / AP)  MADRID — England international midfielder Jude Bellingham faces a lengthy spell on the sidelines after suffering a hamstring injury in the opening minutes of Real Madrid’s

Hong Kong Citizens Benefit from Visa Exemption in Colombia While Taiwan Faces Tougher Entry Rules: A Look at the Impact on Travelers Heading to Bogotá, Medellín, and Beyond – Here’s What to Know Before You Travel

Home » VISA AND PASSPORT NEWS » Hong Kong Citizens Benefit from Visa Exemption in Colombia While Taiwan Faces Tougher Entry Rules: A Look at the Impact on Travelers Heading to Bogotá, Medellín, and Beyond – Here’s What to Know Before You Travel Published on February 2, 2026 Starting January 30, 2026, a new shift

The Beauty Episode 5 Release Date, Time, Where to Watch

FX’s The Beauty Episode 5 release date and time are not far away. In the previous episode, titled “Beautiful Chimp Face,” Cooper continues his investigation into the rampant spread of the Beauty virus. During his investigation, he learns that a guy named Manny was exposed to the virus after the explosion. But before he can interrogate him properly,

Nicki Minaj roasted at Grammys for Trump support

Feb. 1, 2026, 9:10 p.m. ET Nicki Minaj may not be up for a Grammy this year, but she’s still a hot topic. Grammy Awards host Trevor Noah poked fun at the outspoken rapper, who’s made headlines recently for her vocal support of President Donald Trump, during his opening monologue at the ceremony on Sunday,

Japan PMI manufacturing finalized at 51.5, growth returns, inflation a risk

Japan PMI manufacturing finalized at 51.5, growth returns, inflation a risk

Japan’s manufacturing sector returned to expansion in January, with PMI Manufacturing finalized at 51.5. This marks the first improvement in operating conditions since mid-2025 and represents the strongest rate of growth since August 2022, offering early evidence of a cyclical recovery taking hold. The details were encouraging. S&P Global Market Intelligence noted that output and

Real Madrid receive defender offer from Premier League club

Real Madrid are unlikely to be busy at all before the winter transfer window closes for business on Monday evening, but there is a possibility for one or two deals to do – albeit, they would be outgoings. The club has already decided to extend their streak of signing no one during January, which dates

The Best Stocks to Invest $500 in This February

There are plenty of strong growth and value stocks available to buy right now. If you’ve got $500 sitting around, there are shares of a few companies that you can scoop up. If you don’t have access to fractional shares at your brokerage, this task may be a bit more difficult. However, all of the

Mobile phone, sim seized during inspection at prison | Mangaluru News

Mangaluru: A surprise inspection conducted at the Mangaluru district prison led to the seizure of prohibited items, including a mobile phone and SIM card, from an inmate.The complainant, Sharanabasappa, superintendent of the district prison stated that on Jan 30, he, along with other officers conducted a surprise inspection inside the prison. During the inspection, while

Belen Celestial of Trumpington, Cambridge, passed away peacefully on Friday 9th January 2026, at home, aged 79 years

Death notices and funeral announcements from Cambridgeshire this week

Our thoughts are with those who have lost a loved one Belen Celestial of Trumpington, Cambridge, passed away peacefully on Friday 9th January 2026, at home, aged 79 years(Image: funeral-notices) Announcing the passing of a loved one in local news media is a long standing tradition and we are proud of the trust placed in

Indian Billionaire Tapped Jeffrey Epstein Before Modi’s Visits to U.S. and Israel

Documents released by the U.S. Department of Justice on Friday reveal previously unreported details about financier and convicted sex offender Jeffrey Epstein’s role as a backroom power broker amid the rapid strengthening of India-Israel ties in 2017. Epstein connected an Indian billionaire close to Prime Minister Narendra Modi with former Israeli prime minister Ehud Barak

BYD's new generation ATTO3 has been launched in Hong Kong with an indicative price of 188,000 Hong Kong dollars.

BYD’s new generation ATTO3 has been launched in Hong Kong with an indicative price of 188,000 Hong Kong dollars.

BYD (01211.HK) announced that the 2026 model of its next-generation “ATTO 3” has officially launched in Hong Kong. Under the “One-for-One Replacement” scheme, the indicative price is set at HKD 188,000. While retaining the original platform, the new model enhances user experience through detailed upgrades. This facelift marks the third generation of the “ATTO 3,”

Supercomputer Predicts 2025–26 Premier League Table As Arsenal Pounce on Double Stumble

As it is so often proven, a week is an awfully long time in football. Just last weekend, Arsenal’s mentality was being openly derided—by friends and foes alike—opening the door for Manchester City and Aston Villa to capitalise upon yet another slip-up from the Premier League’s perennial runners-up. Yet, this weekend’s results have seen Arsenal

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