<?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>DEV Community: Joe Andersen</title>
    <description>The latest articles on DEV Community by Joe Andersen (@joe_andersen_04505c590cb4).</description>
    <link>https://dev.to/joe_andersen_04505c590cb4</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4008424%2F62275988-8888-451d-9209-5ce289ad150c.png</url>
      <title>DEV Community: Joe Andersen</title>
      <link>https://dev.to/joe_andersen_04505c590cb4</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/joe_andersen_04505c590cb4"/>
    <language>en</language>
    <item>
      <title>JSON Mapper tool</title>
      <dc:creator>Joe Andersen</dc:creator>
      <pubDate>Fri, 07 Aug 2026 15:43:17 +0000</pubDate>
      <link>https://dev.to/joe_andersen_04505c590cb4/json-mapper-tool-2n9h</link>
      <guid>https://dev.to/joe_andersen_04505c590cb4/json-mapper-tool-2n9h</guid>
      <description>&lt;p&gt;How I Built a "Map by Example" JSON Transformer in Vanilla JS (100% Client-Side)&lt;br&gt;
As developers, we’ve all spent too much time writing tedious boilerplate code to map one JSON structure to another. I wanted to solve this for myself, but I had two strict requirements:&lt;/p&gt;

&lt;p&gt;No manual rule writing: I wanted to just provide a "Source" and a "Target" and let the tool figure it out.&lt;br&gt;
100% Privacy: I didn't want my data (or my users' data) ever hitting a server.&lt;br&gt;
In this post, I’ll break down the technical challenges of building a multi-level wildcard mapper and why I chose a pure client-side approach.&lt;/p&gt;

&lt;p&gt;The Challenge: Mapping by Example&lt;br&gt;
The core logic of the tool is an inference engine. Instead of the user defining target.name = source.user_info.full_name, the engine compares two objects and generates those paths automatically.&lt;/p&gt;

&lt;p&gt;Handling Wildcards and Arrays&lt;br&gt;
One of the hardest parts was handling multi-level arrays. If you have a list of users, each with a list of tags, how do you map that without losing the structure?&lt;/p&gt;

&lt;p&gt;I implemented a wildcard mapper in vanilla JavaScript that identifies patterns in the source array and applies the transformation logic across all siblings. This allows for complex transformations like: users[&lt;em&gt;].posts[&lt;/em&gt;].title -&amp;gt; data.articles[*].headline&lt;/p&gt;

&lt;p&gt;Why Vanilla JS and Client-Side?&lt;br&gt;
I decided to keep the entire application as a Single Page Application (SPA) with no backend processing for two reasons:&lt;/p&gt;

&lt;p&gt;Performance: There is zero latency from server round-trips. The mapping happens as fast as the browser can execute the JS.&lt;br&gt;
Security &amp;amp; Privacy: JSON often contains sensitive data (PII, API keys, etc.). By keeping everything in the browser, I can guarantee that the data never leaves the user's machine.&lt;br&gt;
Lessons Learned&lt;br&gt;
Obfuscation vs. Security: Since the logic is client-side, I used Terser for obfuscation. While it's not a replacement for server-side logic for proprietary secrets, it’s a great way to keep the payload small and the code clean.&lt;br&gt;
UX for Developers: Developers value speed. Adding features like a "Save to File" button and instant live previews made the tool significantly more useful.&lt;br&gt;
Try it out&lt;br&gt;
I’ve made the tool free to use. I’d love to get your feedback on the mapping logic, especially if you have complex JSON structures that usually break standard mappers.&lt;/p&gt;

&lt;p&gt;Live Tool: &lt;a href="https://jsonmapper.a7soft.com" rel="noopener noreferrer"&gt;https://jsonmapper.a7soft.com&lt;/a&gt; &lt;br&gt;
GitHub: &lt;a href="https://github.com/ykernogo-boop/json-mapper" rel="noopener noreferrer"&gt;https://github.com/ykernogo-boop/json-mapper&lt;/a&gt;&lt;br&gt;
YouTube: &lt;a href="https://www.youtube.com/watch?v=F0Ddd1ONPE8" rel="noopener noreferrer"&gt;https://www.youtube.com/watch?v=F0Ddd1ONPE8&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I’m curious—how do you usually handle complex JSON transformations in your workflow?&lt;br&gt;
Do you write custom scripts, or is there a tool you swear by? Let's discuss in the comments!&lt;/p&gt;

&lt;h1&gt;
  
  
  javascript #webdev #programming #json
&lt;/h1&gt;

</description>
      <category>javascript</category>
      <category>showdev</category>
      <category>tools</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
