The missing bridge in web development – JSON forms
- Published at
- Updated at
- Reading time
- 2min
Jim Nielsen did what he always does and shared some thoughts on the web platform. And he hit the nail on the head with "Browsers, JSON, and FormData".
So what's the current state of the web?
It's bloated with truckloads of JavaScript, and APIs power everything. APIs won't go anywhere, but we're all working on reducing JavaScript.
To drop some code while still relying on APIs, there are two options:
We need either 1) more APIs that speak FormData, or 2) browsers that speak JSON.
On point, Jim! On point. 💯
I don't think all these APIs will adopt FormData, but think of it: isn't it wild that JSON APIs only work with JavaScript and Ajax because JSON requests aren't supported in HTML?
With the rise of all these JSON APIs, we either have to rely on client-side JavaScript to talk to APIs directly or pipe everything through a serverless function. And we're so used to doing this that we don't even question it anymore.
The web platform is entirely broken in that sense if you ask me. And it's funny, because Jim dug up a spec that aimed to bring JSON into HTML. 😲
<form enctype='application/json'>
<input name='name' value='Bender'>
<select name='hind'>
<option selected>Bitable</option>
<option>Kickable</option>
</select>
<input type='checkbox' name='shiny' checked>
</form>
Unfortunately, the spec went nowhere...
But think of it: if browsers vendors could come together and put JSON support into HTML forms, and support View transitions (formerly known as Shared Element Transistions), the web could really catch up and become the platform it needs to be.
Anyways, head over to Jim's blog; it's a good one, I promise!
Join 5.2k readers and learn something new every week with Web Weekly.