npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@quicksuite/form-to-json

v0.1.1

Published

HTML Form → JSON converter with automatic type parsing and syntax-highlighted output. Part of QuickSuite ecosystem.

Downloads

202

Readme

@quicksuite/form-to-json

npm version npm downloads license bundle size

Convert any escaped or normal HTML <form> markup into clean, typed JSON — with syntax highlighting, automatic type parsing, and a lightweight embedded viewer UI.
Part of the QuickSuite Developer Toolkit Ecosystem: https://quicksuite.dev


🚀 Overview

@quicksuite/form-to-json is a zero‑dependency browser tool that:

  • Accepts escaped or normal HTML <form> markup
  • Parses it safely using DOMParser
  • Converts the resulting FormData into a clean JSON object
  • Automatically detects:
    • Numbers → number
    • "true" / "false"boolean
    • "null"null
    • Repeated fields → arrays
  • Captures form metadata:
    • __form__action
    • __form__method
  • Renders syntax‑highlighted JSON with a built‑in COPY button
  • Works in plain JS, React, Vue, Next.js, etc.
  • Returns a cleanup function so you can unmount the widget cleanly

✨ Features

  • 📝 Escaped or normal HTML support
    Paste raw HTML or HTML with entities like &lt; / &gt; — both are handled.

  • 🧠 Smart type parsing
    Strings like "42", "true", "false", "null" are converted into proper JS types.

  • 🧩 Form‑aware metadata
    Automatically includes __form__action and __form__method based on the source <form>.

  • 🎨 Developer‑friendly viewer
    Syntax‑highlighted JSON output in a clean UI, plus a one‑click COPY button.

  • 🔌 Framework‑friendly
    Returns a cleanup function that removes listeners, DOM and styles — ideal for SPA frameworks.

  • 🪶 Zero dependencies
    No runtime dependencies — easy to drop into any front‑end stack.


📦 Installation

npm install @quicksuite/form-to-json
# or
yarn add @quicksuite/form-to-json

This package is designed for browser environments. It uses document, DOMParser, FormData and navigator.clipboard.


🧩 Quick Start (Vanilla JS)

<div id="form-json-root"></div>

<script type="module">
  import { renderFormJson } from "@quicksuite/form-to-json";

  // Mount the tool into a DOM element
  const cleanup = renderFormJson("form-json-root");

  // Later, if you want to unmount it:
  // cleanup();
</script>

After mounting:

  1. Paste escaped or normal HTML <form> markup into the textarea.
  2. Click Convert & Format to JSON.
  3. Inspect the syntax‑highlighted JSON and copy it with the COPY button.

🧠 API

renderFormJson(elementId: string): () => void

Mounts the HTML Form → JSON converter into the target element.

  • elementId: The id of the DOM element where the tool should be rendered.
  • Returns: A cleanup function that:
    • Removes event listeners
    • Clears the container DOM
    • Removes injected styles

Use this cleanup in SPA frameworks to avoid memory leaks or duplicated styles on remount.


🏗️ Usage with Frameworks

React / Next.js

Call renderFormJson only on the client, for example inside a useEffect hook:

import { useEffect } from "react";
import { renderFormJson } from "@quicksuite/form-to-json";

export function FormJsonTool() {
  useEffect(() => {
    const cleanup = renderFormJson("form-json-root");
    return () => cleanup();
  }, []);

  return <div id="form-json-root" />;
}

In Next.js, ensure this component is used in a client component (add "use client" at the top if needed).

Vue (example)

import { onMounted, onBeforeUnmount } from "vue";
import { renderFormJson } from "@quicksuite/form-to-json";

export default {
  name: "FormJsonTool",
  setup() {
    let cleanup: (() => void) | null = null;

    onMounted(() => {
      cleanup = renderFormJson("form-json-root");
    });

    onBeforeUnmount(() => {
      if (cleanup) {
        cleanup();
      }
    });

    return {};
  },
};
<template>
  <div id="form-json-root"></div>
</template>

🌐 Environment & Limitations

  • Runs in browsers (not designed for Node.js without a DOM shim).
  • Uses:
    • document.createElement
    • DOMParser
    • FormData
    • navigator.clipboard
  • If navigator.clipboard is not available (older browsers / insecure contexts), the COPY button falls back to a manual copy prompt.

🔁 Versioning & Changelog

This project follows semantic versioning:

  • MAJOR: breaking changes
  • MINOR: new features, backwards compatible
  • PATCH: bug fixes and small improvements

Changelog entries are managed per GitHub release. Each tag (vX.Y.Z) should include a short summary of changes.


📷 Screenshot

You can add a screenshot or GIF here once the package is live and rendered in your site or a Codesandbox demo.


🤝 Contributing

Issues and pull requests are welcome.

  • GitHub: https://github.com/QuickSuiteDev/qs-form-to-json
  • Please keep the scope focused: HTML Form → JSON parsing and viewer UX.

For larger ideas or ecosystem‑wide discussions, see the QuickSuite organization and website:

  • https://github.com/QuickSuiteDev
  • https://quicksuite.dev

📄 License

MIT © QuickSuite / Burak Karakaya