<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Sagar Budhwani</title>
    <description>The latest articles on Forem by Sagar Budhwani (@sagarbudhwani).</description>
    <link>https://forem.com/sagarbudhwani</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3730618%2F9a96b8e2-3e9e-4991-9af4-507416cafc00.gif</url>
      <title>Forem: Sagar Budhwani</title>
      <link>https://forem.com/sagarbudhwani</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/sagarbudhwani"/>
    <language>en</language>
    <item>
      <title>Why I stopped pasting API keys into random online converters (so I built a local one)</title>
      <dc:creator>Sagar Budhwani</dc:creator>
      <pubDate>Sat, 24 Jan 2026 20:05:35 +0000</pubDate>
      <link>https://forem.com/sagarbudhwani/why-i-stopped-pasting-api-keys-into-random-online-converters-so-i-built-a-local-one-24jk</link>
      <guid>https://forem.com/sagarbudhwani/why-i-stopped-pasting-api-keys-into-random-online-converters-so-i-built-a-local-one-24jk</guid>
      <description>&lt;h2&gt;
  
  
  The "Paranoia" Problem 🕵️‍♂️
&lt;/h2&gt;

&lt;p&gt;We've all been there. You get a massive JSON response from an API, and you need to type it out for your TypeScript interface.&lt;/p&gt;

&lt;p&gt;The lazy (and normal) solution is to Google "JSON to TS", click the first link, and paste your data.&lt;/p&gt;

&lt;p&gt;But recently, I paused. &lt;strong&gt;I was about to paste a JSON blob containing user emails and a few internal IDs into a random website.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I checked the network tab of that site, and sure enough. it was sending a POST request to their backend. Why? I don't know. Maybe for analytics, maybe to train an AI, or maybe just bad architecture.&lt;/p&gt;

&lt;p&gt;But I realized: &lt;strong&gt;I don't need a server to parse JSON. My browser can do that.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution: 100% Client-Side 🛡️
&lt;/h2&gt;

&lt;p&gt;I spent the weekend building &lt;strong&gt;&lt;a href="https://json2ts.js.org/" rel="noopener noreferrer"&gt;json2ts.js.org&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;It is a simple, no-nonsense tool that does one thing: &lt;strong&gt;Converts JSON to TypeScript Interfaces.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;But the main feature isn't the conversion - it's the architecture.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;✅ &lt;strong&gt;Zero Backend:&lt;/strong&gt; There is no API. If you disconnect your WiFi, the site still works perfectly.&lt;/li&gt;
&lt;li&gt;✅ &lt;strong&gt;Privacy:&lt;/strong&gt; Your data never leaves &lt;code&gt;window.localStorage&lt;/code&gt; (or purely memory).&lt;/li&gt;
&lt;li&gt;✅ &lt;strong&gt;Recursive Parsing:&lt;/strong&gt; It handles nested arrays/objects and generates clean, named interfaces (not just &lt;code&gt;any&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How it works (The Logic) 🧠
&lt;/h2&gt;

&lt;p&gt;I built this using &lt;strong&gt;React + Vite&lt;/strong&gt;. The core logic uses a recursive function to traverse the JSON tree.&lt;/p&gt;

&lt;p&gt;If it finds an &lt;code&gt;object&lt;/code&gt;, it creates a new Interface name (e.g., &lt;code&gt;RootObject&lt;/code&gt;, &lt;code&gt;User&lt;/code&gt;, &lt;code&gt;Address&lt;/code&gt;). If it finds a primitive, it maps it to &lt;code&gt;string&lt;/code&gt;, &lt;code&gt;number&lt;/code&gt;, or &lt;code&gt;boolean&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Here is a snippet of the recursive logic:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Simplified logic&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;parse&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;typeof&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;object&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;obj&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;any&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;keys&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Object&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;obj&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`export interface &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; {\n`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="nx"&gt;keys&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Recursively check values...&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Why not just use a VS Code Extension? 🔌
&lt;/h2&gt;

&lt;p&gt;I know, I know. &lt;em&gt;"There's an extension for that!"&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;And I use them too. But sometimes, I'm debugging in Chrome DevTools, or I'm on a different machine, or I just want a quick visual check without polluting my codebase with temporary files.&lt;/p&gt;

&lt;p&gt;I wanted a URL I could bookmark that loads instantly and doesn't spy on me.&lt;/p&gt;

&lt;h2&gt;
  
  
  Roadmap (Zod is coming!) 🗺️
&lt;/h2&gt;

&lt;p&gt;Right now, it just does &lt;strong&gt;TypeScript Interfaces&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;But since everyone (including me) is moving to &lt;strong&gt;Zod&lt;/strong&gt; for runtime validation, my next goal is to add a toggle:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;[ TypeScript Interface | Zod Schema ]&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it out (Roast my Code) 🧪
&lt;/h2&gt;

&lt;p&gt;I hosted it on the community &lt;code&gt;js.org&lt;/code&gt; domain because I want this to be a free utility for everyone.&lt;/p&gt;

&lt;p&gt;👉 &lt;strong&gt;Live Demo:&lt;/strong&gt; &lt;a href="https://json2ts.js.org/" rel="noopener noreferrer"&gt;https://json2ts.js.org/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let me know if you find any bugs or edge cases where the parser fails! I'm actively fixing them this week.&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>react</category>
      <category>webdev</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
