<?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: Timur</title>
    <description>The latest articles on DEV Community by Timur (@saint_moore).</description>
    <link>https://dev.to/saint_moore</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%2F4225355%2F96e7690f-d775-4575-a50c-c212e0bd8d3a.jpg</url>
      <title>DEV Community: Timur</title>
      <link>https://dev.to/saint_moore</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/saint_moore"/>
    <language>en</language>
    <item>
      <title>The exchange form was the easy part</title>
      <dc:creator>Timur</dc:creator>
      <pubDate>Tue, 24 Nov 2026 14:16:00 +0000</pubDate>
      <link>https://dev.to/saint_moore/the-exchange-form-was-the-easy-part-3784</link>
      <guid>https://dev.to/saint_moore/the-exchange-form-was-the-easy-part-3784</guid>
      <description>&lt;p&gt;When we shipped YourPlus the flow was one screen: you say what you want to receive, you get options, you send. That part shipped a while ago and it still works. It is not the part that took the engineering.&lt;/p&gt;

&lt;p&gt;The hard question sits one layer down: &lt;em&gt;which of those options actually exist?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A catalogue is a list of tickers — DOGE, ADA, LINK, PEPE, a hundred-plus of them. But a ticker is not an asset. The same ticker on different chains is a different thing, and whether an asset is executable on a given provider at a given moment is data nobody publishes. So the aggregator's temptation is to show a spot mid-market number, call it a rate, and let the user discover the difference after the funds have left. Two to five percent between quote and arrival is the usual outcome — when the route existed at all. A "best rate" screen is a promise the exchange cannot keep.&lt;/p&gt;

&lt;p&gt;We wanted a screen where every option is real. What follows is what that took.&lt;/p&gt;

&lt;h2&gt;
  
  
  What we built instead of live polling
&lt;/h2&gt;

&lt;p&gt;The obvious approach is to ask every provider about everything on every request. We tried it. Polling a hundred-plus assets across the executable provider set produced stampedes, 429s, and quotes stale by the time they were drawn — and a stale quote is not a quote.&lt;/p&gt;

&lt;p&gt;So we inverted it. Instead of the product pulling the world, the world pushes one small file once a day and the product loads it only when someone actually asks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a GitHub Action builds the catalogue and uploads it to a private GCS bucket;&lt;/li&gt;
&lt;li&gt;the Mini App loads it on the first request, then revalidates on a 24-hour TTL or on an explicit miss;&lt;/li&gt;
&lt;li&gt;nothing polls on a timer, which matters: Cloud Run instances freeze without traffic, so a &lt;code&gt;setInterval&lt;/code&gt; is a lie about liveness;&lt;/li&gt;
&lt;li&gt;a fallback catalogue is baked into the binary, so a cold start never has an empty screen.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F69d94yn8ff7xmffvu1z9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F69d94yn8ff7xmffvu1z9.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Architecture: one JSON file, loaded on demand
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌─────────────┐     daily      ┌──────────────┐     on request      ┌──────────────┐
│ GH Actions  │ ─────────────► │  GCS Bucket  │ ◄────────────────── │ Cloud Run    │
│ (WIF auth)  │   catalog.json │ (private)    │  24h TTL / initData │  Mini App    │
└─────────────┘                └──────────────┘                     └──────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;scripts/refresh-curated-pairs.ts&lt;/code&gt; runs daily (Workload Identity Federation → GCS, no long-lived keys)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;CuratedRouteDiscoveryAdapter&lt;/code&gt; loads on first request and revalidates after 24h or on explicit miss&lt;/li&gt;
&lt;li&gt;fallback catalogue in the binary for cold starts&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The rotation itself is fifteen owner-approved assets — USDT, BTC, ETH, TON, SOL, XRP, BNB, USDC, TRX, DOGE, NOT, ADA, LINK, AVAX and PEPE — posted one pair per two-hour window. The rotation is the ticker list we publish; it is not the catalogue's size, and the point of holding it at fifteen is that these are the routes we can defend rather than a hundred we cannot.&lt;/p&gt;

&lt;h2&gt;
  
  
  The bug that taught us what an asset actually is
&lt;/h2&gt;

&lt;p&gt;ChangeNOW lists DOGE twice: &lt;code&gt;doge&lt;/code&gt;, native Dogecoin, and &lt;code&gt;dogeerc20&lt;/code&gt;, an ERC-20 token carrying the same ticker at a wildly different price. Our &lt;code&gt;defaultReceiveNetwork("DOGE")&lt;/code&gt; returned &lt;code&gt;ethereum&lt;/code&gt;. The engine then did its job flawlessly on the wrong asset — off by about three orders of magnitude — and nothing downstream was in a position to object, because a wrong-network token with the right ticker is a perfectly well-formed row.&lt;/p&gt;

&lt;p&gt;The fix was a network map, not a special case:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;DOGE → &lt;code&gt;doge&lt;/code&gt; (native)&lt;/li&gt;
&lt;li&gt;ADA → &lt;code&gt;ada&lt;/code&gt; (native Cardano)&lt;/li&gt;
&lt;li&gt;AVAX → &lt;code&gt;cchain&lt;/code&gt; (Avalanche C-Chain)&lt;/li&gt;
&lt;li&gt;NOT → &lt;code&gt;ton&lt;/code&gt; (Notcoin on TON)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It lives in &lt;code&gt;src/app/address-rules.ts&lt;/code&gt; and &lt;code&gt;src/adapters/changenow-networks.ts&lt;/code&gt;, and in the script that builds the catalogue. The rule we took from it: we guarantee the network, not the symbol.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F48bppgfol39u4qjuhoug.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F48bppgfol39u4qjuhoug.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The long tail needs mids, not just a price list
&lt;/h2&gt;

&lt;p&gt;The product sells a plus against a baseline — roughly what the same amount would fetch on a CEX right now. That baseline needs a USD mid per asset, and it needs it for the tail, not only the majors. The &lt;code&gt;COINGECKO_IDS&lt;/code&gt; map covered ten majors; DOGE, NOT, ADA, LINK, AVAX and PEPE were absent, which silently disabled both the baseline and the spot guard exactly where the tail lives.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// src/adapters/spot-mid.ts&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;COINGECKO_IDS&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Record&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// ... majors ...&lt;/span&gt;
  &lt;span class="no"&gt;DOGE&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"dogecoin"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="no"&gt;NOT&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"notcoin"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="no"&gt;ADA&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"cardano"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="no"&gt;LINK&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"chainlink"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="no"&gt;AVAX&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"avalanche-2"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="no"&gt;PEPE&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"pepe"&lt;/span&gt;&lt;span class="p"&gt;,&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;p&gt;Two gates now run across the whole wave. In practice this is the difference between a rate claim you can check and a rate claim you decorate.&lt;/p&gt;

&lt;h2&gt;
  
  
  A quote engine that has to converge
&lt;/h2&gt;

&lt;p&gt;For some pairs the provider has to be walked toward the answer rather than asked once. ChangeNOW's reverse &lt;code&gt;estimated-amount&lt;/code&gt; oscillates near the provider minimum:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Iteration 0: 12.73 USDT → 94.59 DOGE  (under)
Iteration 1: 13.55 USDT → 105.61 DOGE (over)
Iteration 2: 12.82 USDT → 95.80 DOGE  (under)
... oscillates, never lands in ±1.5%
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The interesting part is &lt;em&gt;why&lt;/em&gt; it never converged, because it was not the probing. The engine already rejects any fill that undershoots the request by more than 1% or overshoots the ask by more than 5%. The adapter's own acceptance window was far wider than that — it treated a probe landing several percent over as a valid answer, handed it to the engine, and the engine threw the route away. The adapter then re-probed from a different angle and the cycle repeated.&lt;/p&gt;

&lt;p&gt;Narrowing the adapter's window to &lt;code&gt;[desired×0.995, desired×1.015]&lt;/code&gt; — strictly inside the engine's window — was the whole fix. A probe that the adapter accepts is now a probe the engine keeps:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// src/adapters/changenow-adapter.ts&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;got&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;desired&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.995&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;got&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;desired&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;1.015&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;outcome&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="p"&gt;}&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;p&gt;That is the general lesson of this build: two components that each have a tolerance are not compatible just because both tolerances exist. The inner one has to be narrow enough that nothing it accepts can be rejected downstream.&lt;/p&gt;

&lt;h2&gt;
  
  
  Results
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;15/15 curated assets executable at rotation amounts&lt;/li&gt;
&lt;li&gt;rotation 9 → 15 entries, one pair per two-hour window&lt;/li&gt;
&lt;li&gt;request-driven catalogue load with a 24h TTL and a baked-in cold-start fallback&lt;/li&gt;
&lt;li&gt;typecheck ✅ · 234/234 tests ✅ · build ✅&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Try it:&lt;/strong&gt; &lt;code&gt;https://t.me/YourPlus_app_bot&lt;/code&gt;&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>crypto</category>
      <category>web3</category>
    </item>
    <item>
      <title>Comparing JSON Files: Practical Diffing Strategies for Developers</title>
      <dc:creator>Timur</dc:creator>
      <pubDate>Wed, 04 Nov 2026 04:44:53 +0000</pubDate>
      <link>https://dev.to/saint_moore/comparing-json-files-practical-diffing-strategies-for-developers-2ndb</link>
      <guid>https://dev.to/saint_moore/comparing-json-files-practical-diffing-strategies-for-developers-2ndb</guid>
      <description>&lt;h1&gt;
  
  
  A story you have probably lived
&lt;/h1&gt;

&lt;p&gt;Staging deploy goes out. Something breaks downstream.&lt;/p&gt;

&lt;p&gt;So you do the obvious thing: export the payload from production, export the payload from staging, and run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;diff &lt;span class="nt"&gt;-u&lt;/span&gt; prod.json staging.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And diff hands you 400 changed lines. Two files. Same data. Completely unchanged schema.&lt;/p&gt;

&lt;p&gt;Except one service decided to sort keys alphabetically, and the other preserved insertion order. And one of them pretty-printed the output while the other minified it. Both sets of choices are perfectly valid JSON. &lt;code&gt;diff&lt;/code&gt; sees the first file and the second file as having almost nothing in common.&lt;/p&gt;

&lt;p&gt;That is the moment it is worth understanding what is actually going on, because the fix is not "use a diff tool with nicer colors."&lt;/p&gt;

&lt;p&gt;Let me talk about why this happens, then the three approaches I use depending on where I am standing.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why line-based diffing breaks on JSON
&lt;/h1&gt;

&lt;p&gt;Two reasons, and both come from JSON's own spec.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Object keys have no order.&lt;/strong&gt; RFC 8259 describes JSON as an unordered collection of key/value pairs. The spec is explicit: key order carries no semantic meaning. So &lt;code&gt;{"id":1042,"status":"active"}&lt;/code&gt; and &lt;code&gt;{"status":"active","id":1042}&lt;/code&gt; are the &lt;em&gt;same document&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;POSIX &lt;code&gt;diff&lt;/code&gt; has no idea about that. It computes the longest common subsequence of lines, and a line sequence is absolute truth to it. Reorder the keys and you get a full-file churn report even though not a single value changed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Whitespace is arbitrary.&lt;/strong&gt; JSON permits any amount of whitespace around structural tokens: space, tab, &lt;code&gt;\n&lt;/code&gt;, &lt;code&gt;\r&lt;/code&gt;. A minified payload and its pretty-printed twin tokenize to identical trees. To &lt;code&gt;diff&lt;/code&gt;, they have zero matching lines.&lt;/p&gt;

&lt;p&gt;Here are the two payloads from the story above:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;payload_a.json&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1042&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"active"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"tags"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"prod"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"auth"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;payload_b.json&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;—&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;same&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;record,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;reordered&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"tags"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"prod"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"auth"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1042&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"active"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;diff &lt;span class="nt"&gt;-u&lt;/span&gt; payload_a.json payload_b.json
@@ &lt;span class="nt"&gt;-1&lt;/span&gt;,5 +1,5 @@
 &lt;span class="o"&gt;{&lt;/span&gt;
+  &lt;span class="s2"&gt;"tags"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"prod"&lt;/span&gt;, &lt;span class="s2"&gt;"auth"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;,
   &lt;span class="s2"&gt;"id"&lt;/span&gt;: 1042,
-  &lt;span class="s2"&gt;"status"&lt;/span&gt;: &lt;span class="s2"&gt;"active"&lt;/span&gt;,
-  &lt;span class="s2"&gt;"tags"&lt;/span&gt;: &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"prod"&lt;/span&gt;, &lt;span class="s2"&gt;"auth"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;,
+  &lt;span class="s2"&gt;"status"&lt;/span&gt;: &lt;span class="s2"&gt;"active"&lt;/span&gt;
 &lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Four "changed" lines. Zero actual differences. In a deployment audit this is noise, and in an automated change-detection script it is a broken build.&lt;/p&gt;

&lt;p&gt;The underlying fix is to compare &lt;em&gt;structure&lt;/em&gt;, not text. Parse both documents, normalize, then compare the trees.&lt;/p&gt;

&lt;h1&gt;
  
  
  Three approaches, by where you're standing
&lt;/h1&gt;

&lt;h2&gt;
  
  
  1. Local triage: canonicalize, then diff
&lt;/h2&gt;

&lt;p&gt;For fast shell work, normalize first so plain &lt;code&gt;diff&lt;/code&gt; has a fair shot:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;diff &lt;span class="nt"&gt;-u&lt;/span&gt; &amp;lt;&lt;span class="o"&gt;(&lt;/span&gt;jq &lt;span class="nt"&gt;-S&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; payload-v1.json&lt;span class="o"&gt;)&lt;/span&gt; &amp;lt;&lt;span class="o"&gt;(&lt;/span&gt;jq &lt;span class="nt"&gt;-S&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; payload-v2.json&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;-S&lt;/code&gt; sorts keys, so key order stops being a problem. Whitespace stops being a problem too, because &lt;code&gt;jq&lt;/code&gt; re-serializes both files in its own canonical style.&lt;/p&gt;

&lt;p&gt;Where it still fails: &lt;strong&gt;arrays&lt;/strong&gt;. Line-based diff compares array elements by position, so an unordered set coming back in a different order looks like three value substitutions instead of one permutation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Payload&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;A&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"services"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"auth"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"billing"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"gateway"&lt;/span&gt;&lt;span class="p"&gt;]}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;span class="err"&gt;//&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Payload&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;B&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;—&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;same&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;set,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;different&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;order&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"services"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"billing"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"gateway"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"auth"&lt;/span&gt;&lt;span class="p"&gt;]}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you need real structural comparison in the terminal, &lt;code&gt;jd&lt;/code&gt; does its own AST comparison and emits RFC 6902 JSON Patch operations (&lt;code&gt;add&lt;/code&gt;, &lt;code&gt;remove&lt;/code&gt;, &lt;code&gt;replace&lt;/code&gt;). It is the right tool when you want machine-readable output.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. CI/CD: pick a structural diff library
&lt;/h2&gt;

&lt;p&gt;In an integration test, asserting on two large payloads should not shell out. And &lt;code&gt;assert.deepStrictEqual()&lt;/code&gt; gives you an unreadable blob when both objects have several hundred keys.&lt;/p&gt;

&lt;p&gt;What you want is a library that understands structures:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;deepdiff&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;DeepDiff&lt;/span&gt;

&lt;span class="n"&gt;diff&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;DeepDiff&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;payload_v1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;payload_v2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;ignore_order&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;        &lt;span class="c1"&gt;# treat arrays as unordered sets
&lt;/span&gt;    &lt;span class="n"&gt;significant_digits&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;     &lt;span class="c1"&gt;# tolerate float drift
&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Node's &lt;code&gt;jsondiffpatch&lt;/code&gt; is the equivalent in the JS world. The important part is not which library — it is that you can express &lt;em&gt;what "equal" means for your domain&lt;/em&gt;: ignore the timestamp column, round the currency, treat that one array as a set.&lt;/p&gt;

&lt;p&gt;That last part is where line-based tools can never follow you.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Debugging in the browser: don't upload the payload at all
&lt;/h2&gt;

&lt;p&gt;This is where I got personal about it.&lt;/p&gt;

&lt;p&gt;Sometimes the payload you need to compare is a customer's production record, or something covered by a contract that says "not processed outside agreed infrastructure." Pasting it into a random online JSON tool is exactly the wrong move, and half the tools you would reach for are upload-by-design.&lt;/p&gt;

&lt;p&gt;So I built the thing I wanted: a JSON formatter and mapper that runs &lt;strong&gt;entirely in the browser&lt;/strong&gt;. One HTML file, no backend, nothing leaves your machine. It parses, compares and exports CSV client-side, and it works offline once you have the file.&lt;/p&gt;

&lt;p&gt;If you want to poke at it: &lt;a href="https://localjson-black.vercel.app/" rel="noopener noreferrer"&gt;LocalJSON&lt;/a&gt; — free tier with no account, Pro is a one-time $5 if you need the offline standalone version and unlimited runs.&lt;/p&gt;

&lt;p&gt;The comparison logic itself is worth understanding regardless of which tool you use, and there is a longer write-up with all the edge cases in my &lt;a href="https://localjson-black.vercel.app/blog/compare-json-files/" rel="noopener noreferrer"&gt;Comparing JSON Files&lt;/a&gt; piece — including the floating-point trap, which is nastier than the ordering one.&lt;/p&gt;

&lt;h1&gt;
  
  
  The part nobody warns you about
&lt;/h1&gt;

&lt;p&gt;Two edge cases that bite after you think you're done.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Array ordering semantics.&lt;/strong&gt; RFC 8259 guarantees array order, but applications routinely use arrays for sets — permissions lists, database rows without an &lt;code&gt;ORDER BY&lt;/code&gt;. If you must compare such arrays, find a unique key (&lt;code&gt;id&lt;/code&gt;, &lt;code&gt;uuid&lt;/code&gt;) and correlate on that instead of by index. Positional comparison will lie to you forever otherwise.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Floating-point precision.&lt;/strong&gt; JSON has no distinction between integer and float; it is just "number." Parsers then cast to IEEE 754 doubles, and runtimes disagree about how to print the result:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Runtime&lt;/th&gt;
&lt;th&gt;Value in memory&lt;/th&gt;
&lt;th&gt;Serialized JSON&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Python &lt;code&gt;json.dumps&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;float(1.0)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1.0&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Node &lt;code&gt;JSON.stringify&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1.0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Go &lt;code&gt;encoding/json&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;&lt;code&gt;float64(1e-4)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0.0001&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Same number, three spellings. Any comparison that is not numeric-aware will report drift that does not exist.&lt;/p&gt;

&lt;h1&gt;
  
  
  Bottom line
&lt;/h1&gt;

&lt;p&gt;If you are diffing JSON, stop diffing JSON as text.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Quick local look → &lt;code&gt;jq -S&lt;/code&gt; + &lt;code&gt;diff&lt;/code&gt;, or &lt;code&gt;jd&lt;/code&gt; when you want a patch.&lt;/li&gt;
&lt;li&gt;Automated checks → &lt;code&gt;deepdiff&lt;/code&gt; / &lt;code&gt;jsondiffpatch&lt;/code&gt; with domain-specific equality rules.&lt;/li&gt;
&lt;li&gt;Sensitive payloads → keep the data in your browser and never upload it.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The whole exercise costs you one insight: compare structure, not lines.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;If you end up trying this on your own payloads, I would genuinely like to hear which of the three approaches your team standardized on — especially whether "ignore this array's order" is a rule you have ever needed in CI.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>json</category>
      <category>diffing</category>
      <category>dbugdiarey</category>
    </item>
  </channel>
</rss>
