DEV Community

mohammedawny59-beep
mohammedawny59-beep

Posted on

I got tired of googling "json formatter" every day, so I built a paste-and-detect tool

Every dev has the same five browser tabs pinned: a JSON formatter, a Base64 decoder, a URL decoder, an epoch timestamp converter. I got tired of opening a different site for each one, so I built a single page that detects what you pasted and routes you to the right tool.

The detection logic

Nothing fancy, just a chain of cheap checks run in order, entirely client-side:

  1. Try JSON.parse. If it succeeds, it is JSON.
  2. If it fails, check for the shape of "LLM-wrapped" JSON, e.g. text with a stray markdown fence or trailing commas, and try a repair pass before parsing again. A lot of pasted JSON comes straight out of a chatbot response and is technically broken.
  3. Test against a Base64 character set regex and check that decoding round-trips cleanly.
  4. Check for percent-encoding patterns for URL-encoded strings.
  5. Check if the whole string is numeric and within a plausible Unix timestamp range (seconds vs. milliseconds).
  6. Fall back to plain text utilities (case conversion, line sorting, de-duplication) if nothing else matches.

Because everything runs in the browser, nothing you paste ever leaves the page. That mattered to me since I am usually pasting real API responses or config while debugging, not sample data.

Try it

It is free, no signup, no ads: https://quicktinyv2.vercel.app

Curious what other paste-and-detect patterns people have built, or if there is a smarter way to disambiguate JSON vs. Base64 vs. plain text than the ordered-check approach above.

Top comments (0)