How I Built an API That Turns JSON Into Beautiful HTML Forms

Published: (March 1, 2026 at 03:55 PM EST)
2 min read
Source: Dev.to

Source: Dev.to

Forms are one of the most tedious parts of web development. Every project needs them, and every time you build one from scratch — labels, validation, accessibility, styling — you lose hours on boilerplate.

So I built FormForge, a REST API that takes a JSON schema and returns a fully‑styled, accessible HTML form.

The Problem

Building forms well is harder than it looks:

  • Field types need different HTML attributes
  • Validation rules vary per field
  • Accessibility (ARIA labels, error announcements) is easy to forget
  • Mobile responsiveness requires careful CSS
  • Styling consistency across a project takes effort

The Solution

Send JSON, get HTML:

curl -X POST https://formforge-api.vercel.app/api/json-to-form \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Contact Us",
    "theme": "modern",
    "fields": [
      {"name": "name", "type": "text", "label": "Full Name", "required": true},
      {"name": "email", "type": "email", "label": "Email", "required": true},
      {"name": "message", "type": "textarea", "label": "Message"}
    ]
  }'

You get back self‑contained HTML with embedded CSS and validation JS. Drop it into any page.

Features

  • 4 Themes: Modern (emerald), Corporate (navy), Playful (purple), Minimal (monospace)
  • 10 Field Types: text, email, number, textarea, select, checkbox, radio, date, tel, url
  • Built‑in Validation: required fields, email format, URL format, phone patterns
  • Accessible: ARIA attributes, screen reader support, keyboard navigation
  • Responsive: works on mobile out of the box

Free Tier

20 forms/day, no credit card required. Get your API key:

curl -X POST https://formforge-api.vercel.app/api/signup \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com"}'

Try It

  • Live demo:
  • Docs:
  • GitHub:

Part of the Forge API family — also check out DocForge for document conversion and ReportForge for report generation.

0 views
Back to Blog

Related posts

Read more »

JavaScript: The Beginning

JavaScript In 1995, a programmer named Brendan Eich was working at Netscape. At that time, websites were mostly static — they could display information, but the...

Day 27 of #100DaysOfCode — REST API

Whether you realize it or not, you’ve already been using REST APIs every time an app sends a request and receives a response. Your weather app, your social feed...