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

How To Avoid Watered Down Keurig Coffee

D3sign/Getty Images If you’re a true coffee snob (err, connoisseur), you might spend half your morning tinkering to get the right water temperature, grind, and bloom to achieve the perfect pour-over. If you can’t be bothered, like me, then you’re probably all about K-Cups instead. These handy little

An Updated Guide to Valencia, Spain’s Specialty-Coffee Scene

Known for its beaches and laid-back rhythm, Valencia has quietly emerged as a force in Spain’s coffee scene. After two years away, we’re back with more cafés worth visiting in the coastal city. BY ISABELLE MANIBARISTA MAGAZINE ONLINE Featured photo by Chimo Garcia-Menacho de Vargas, courtesy of Valencia is Coffee Blending local charm with international

Latest Coffee Production Cost Report by Procurement Resource

Procurement Resource, a leading provider of procurement intelligence and market research solutions, has launched its latest Coffee Production Cost Report. This in-depth report provides a roadmap for entrepreneurs and businesses looking to establish a successful coffee production unit, offering critical insights into industry trends, plant setup, machinery requirements, cost structures, and investment opportunities. Request for

De’Longhi’s New La Specialista Review by a Former Barista

Having worked in a lot of cafes over the years, I’m confident I can recognize a good machine when I see one. Does it look sleek on the counter? Does it pull a perfectly creamy espresso shot? As such, De’Longhi has long been a brand I’ve wanted to try, and the recent release of the

Coffee Machine Market Hits New High

Coffee Machine Market HTF MI just released the Global Coffee Machine Market Study, a comprehensive analysis of the market that spans more than 143+ pages and describes the product and industry scope as well as the market prognosis and status for 2025-2032. The marketization process is being accelerated by the market study’s segmentation by important

Headlines from the Coffee Industry

Our recurring round-up of the latest specialty-coffee industry news. FROM STAFF REPORTS Featured image by Joshua Earle SANA Launches Mental Health & Wellness Program for Women Coffee Farmers SANA has launched its mental health and wellness program to support women coffee farmers. Image courtesy of Lucia Bawot. After a successful pilot in Colombia, SANA is officially launching

Explore the Diverse Offerings of Therobot

In the ever-evolving landscape of coffee consumption, The Robot Coffee Machine emerges as a game-changer, offering a plethora of options that extend far beyond traditional coffee brewing. According to the National Coffee Association, 62% of Americans consume coffee daily, leading to an increased demand for convenience and variety in preparation methods. The Robot Coffee Machine

How Cafes Are Responding to Fear

Amid the turmoil and uncertainty that many of us are feeling, a café can act as a sanctuary—the ultimate safe space. BY MEGAN LLOYDFOR BARISTA MAGAZINE Featured photo by Emma Ou A coffee shop has always been more than a place to drink a caffeinated beverage. Often referred to as a “third space,” or a

Skip the Coffee Shop With $200 Off Our Favorite Breville Espresso Machines

If you’re a true coffee enthusiast who enjoys making a variety of espresso drinks, not just any pod machine will get the job done. Upgrading to a semiautomatic espresso machine can help you live out your barista dreams at home, and Breville makes some of the best. The quality of the espresso these machines brew

Where To Drink Coffee In Hong Kong’s Sheung Wan Neighborhood

Hong Kong is dense. Its buildings, with their varying lines, curves, stacks, and layers, present a unique fingerprint in the city’s iconic skyline—the jaggedness hinting at a seemingly infinite race towards the sky among the architectural giants. Getting lost is an adventure in itself and is probably my favorite way of exploring the city. From

I went hands-on with LG’s coffee-making robot — here’s what happened

I recently had the chance to go to LG’s HQ in South Korea, where I was able to get hands-on with some quirky products I’d never seen before. This included LG’s Ground 220, an experiential space in Seoul where users can play with LG appliances before they buy. And amidst the smart fridges, microwaves, and

A Champion of Vietnamese Coffee

We speak to Tú, the creator of the Phinoi filter, about his shop’s pay-as-you-feel model and his belief in fine robusta. BY VASILEIA FANARIOTISENIOR ONLINE CORRESPONDENT Photos courtesy of Vu Dình Tú In Vietnam’s fast-evolving specialty-coffee scene, Refined. stands out not just for its focus on fine robusta, but for its unconventional business model and

The Best Early Prime Day Deals on De’Longhi Espresso Machines

Retail overlord Jeff Bezos might’ve gifted guests at his lavish Venetian wedding Amazon slippers, but if your invite to his nuptials got lost in the mail, fear not — Italian luxury is still within reach thanks to the De’Longhi deals for Prime Day. Call this early Prime Day deal a honeymoon gift: De’Longhi, makers of

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