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

Treasury yields rise as Trump reiterates Iran infrastructure threat

U.S. Treasury yields rose on Tuesday as President Donald Trump again warned the U.S. would strike Iranian civilian and energy infrastructure if Tehran did not agree to reopen the Strait of Hormuz before a looming deadline. The 10-year Treasury yield — the benchmark for U.S. government borrowing — was more than 1 basis point higher in

Chinese and Taiwanese flags are seen in this illustration. (Reuters)

Taiwan and China are preparing for a summit, of sorts

HISTORY CASTS a long shadow over relations between the Chinese Communist Party and the Kuomintang (KMT), which ruled China until Mao Zedong’s Red Army forced it to flee to Taiwan in 1949. The two parties remained sworn enemies for decades afterwards as the KMT fortified its island refuge with American weapons. Only in 1991, as

All Songs in Zendaya Movie Listed

The Drama is generating excitement as a captivating, emotionally intense film featuring Zendaya and Robert Pattinson in the main roles. Along with its engaging plot, the film’s soundtrack is also attracting attention for seamlessly complementing its dramatic, immersive atmosphere, making viewers eager to explore each song in the experience. Here’s all the information you need

MobilityOne advances Super Apps deal after TETE vote

MobilityOne advances Super Apps deal after TETE vote Proactive uses images sourced from Shutterstock MobilityOne Limited said a key step in its proposed joint venture with Super Apps has been approved, after shareholders in its US partner backed the deal. The company said Technology & Telecommunication Acquisition Corporation has passed all resolutions at an extraordinary

NASA's Artemis II moon rocket lifts off from the Kennedy Space Center's Launch Pad 39-B Wednesday, April 1, 2026, in Cape Canaveral, Fla. (AP Photo/Chris O'Meara)

Iran War Jeopardizes U.S. Global Leadership, Warns Italian Minister

ROME, April 7 (Reuters) – The Iran war has ⁠put ⁠U.S. global leadership on the ⁠line, Italy’s Defence Minister Guido Crosetto said, expressing fear about ​the “madness” of nuclear escalation. Like some other NATO allies reluctant to join U.S. President Donald Trump’s ‌attacks on Iran, Italy last ‌week denied permission for U.S. military aircraft to

EUR/AUD Daily Outlook - ActionForex

EUR/AUD Daily Outlook – ActionForex

Daily Pivots: (S1) 1.6649; (P) 1.6695; (R1) 1.6731; More… Intraday bias in EUR/AUD remains neutral and more consolidations could be seen below 1.6842. On the upside, above 1.6842 will resume the rebound from 1.6125 to 38.2% retracement of 1.8554 to 1.6125 at 1.7053. However, break of 1.6561 minor support will argue that the rebound fro

AI-processed satellite image of US military facilities at Diego Garcia. (Source: MizarVision)

China’s AI Satellites Are Helping Iran Hunt US Bases, Intelligence Warns — UNITED24 Media

Iranian forces are using AI-processed satellite imagery from a Chinese company to improve targeting of US military installations in the Middle East. We bring you stories from the ground. Your support keeps our team in the field. DONATE NOW According to ABC News on April 5, officials from the US Defense Intelligence Agency (DIA) assess that Iran’s Islamic Revolutionary Guard Corps (IRGC) is using

Jeff Bezos’ Project Prometheus taps xAI co-founder Kyle Kosic

Kosic will work on AI infrastructure projects at Prometheus, sources said. xAI co-founder Kyle Kosic has left his role at OpenAI to join Jeff Bezos’ Project Prometheus, reported the Financial Times. Kosic’s departure from xAI in 2024 marked the first of an exodus, which saw the company’s 11th co-founder reportedly leave late last month, leaving

Lennart Karl | Goal.com US

As his career has progressed, Karl has emerged as a genuine star in the making. The player benefits from the advice of German football legend Michael Ballack, who offers him guidance, particularly in defence. As for his role model, Karl makes no secret of his admiration for Martin Ødegaard, saying: “He’s left-footed like me, plays

Amazon.com (AMZN) Price Target Raised by $1

Amazon.com (AMZN) Price Target Raised by $1

Amazon.com, Inc. (NASDAQ:AMZN) is included among the 15 Best S&P 500 Stocks to Buy Right Now. Amazon.com (AMZN) Price Target Raised by $1 christian-wiediger-rymh7EZPqRs-unsplash Amazon.com, Inc. (NASDAQ:AMZN) provides a broad selection, value, and convenience across a range of customer experiences, including online shopping, cloud computing, streaming entertainment, consumer electronic devices, advertising, healthcare, AI services, and

Taiwan opposition leader visits China for first time in a decade

Taiwan opposition leader visits China for first time in a decade

Taiwan opposition leader visits China for first time in a decade The leader of Taiwan’s main opposition party landed in China today, marking the first rare visit in a decade. Cheng Li-wun who took over as Kuomintang (KMT) chairperson last year, gladly accepted the invitation of President Xi Jinping’s and became the party’s first incumbent

A poster for

China’s Qingming Holiday Box Office Falls 19%

A poster for “The Super Mario Galaxy Movie” in Yichang, Hubei province, on April 1, 2026. Photo: VCG China’s Qingming holiday box office fell sharply from a year earlier despite more new releases, more screenings and cheaper tickets, underscoring the lack of a breakout hit to draw moviegoers back to theaters after the Lunar New

Bayern Munich predicted lineup and team news vs Real Madrid

Bayern Munich visit the Santiago Bernabeu as they face Real Madrid in a rivalry known as the European Clásico for the first-leg of their UEFA Champions League quarter-final on Tuesday. Bayern Munich arrive in Madrid in strong form, with a 13‑game unbeaten run across all competitions. Their last match was an exciting 3‑2 comeback win

People walk past a billboard that shows a graphic depicting Iran's Supreme Leader Ayatollah Mojtaba Khamenei in downtown Tehran, Iran. (AP)

As Iran’s civilian economy crumbles, its military economy grows stronger

FOR THE first month of their war on Iran, America and Israel mostly spared civilian infrastructure. In March bombers painstakingly picked around oil terminals and ports while attacking Kharg Island, an energy entrepot. A week later Donald Trump told Israel to stand down after its strikes on South Pars, a gasfield, provoked Iranian retaliation against

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