Son – A minimal subset of JSON for machine-to-machine communication
&gt; Piping JSON through multiple programs creates lots of trivial changes, which makes it hard to do things like take meaningful diffs.<p>That&#x27;s the virtue of having a format which offers a canonical representation for data.<p>&gt; No insignificant whitespace.<p>I.e., it&#x27;s not human-readable.  It also has no decent way to exchange binary data (there is no byte-sequence type: one must either use Base64 or an array of integers, neither of which is space-efficient).<p>It&#x27;d be nice to have a format which is <i>both</i> human-readable <i>and</i> has a canonical representation.  Fortunately, such a thing already exists (and I&#x27;ve even linked to it once already today), and has since <i>1997</i>: <a href="http:&#x2F;&#x2F;people.csail.mit.edu&#x2F;rivest&#x2F;Sexp.txt" rel="nofollow">http:&#x2F;&#x2F;people.csail.mit.edu&#x2F;rivest&#x2F;Sexp.txt</a><p>Here&#x27;s a JSON example (from <a href="http:&#x2F;&#x2F;json.org&#x2F;example.html" rel="nofollow">http:&#x2F;&#x2F;json.org&#x2F;example.html</a>):<p><pre><code>    {
        &quot;glossary&quot;: {
            &quot;title&quot;: &quot;example glossary&quot;,
        &quot;GlossDiv&quot;: {
                &quot;title&quot;: &quot;S&quot;,
          &quot;GlossList&quot;: {
                    &quot;GlossEntry&quot;: {
                        &quot;ID&quot;: &quot;SGML&quot;,
              &quot;SortAs&quot;: &quot;SGML&quot;,
              &quot;GlossTerm&quot;: &quot;Standard Generalized Markup Language&quot;,
              &quot;Acronym&quot;: &quot;SGML&quot;,
              &quot;Abbrev&quot;: &quot;ISO 8879:1986&quot;,
              &quot;GlossDef&quot;: {
                            &quot;para&quot;: &quot;A meta-markup language, used to create markup languages such as DocBook.&quot;,
                &quot;GlossSeeAlso&quot;: [&quot;GML&quot;, &quot;XML&quot;]
                        },
              &quot;GlossSee&quot;: &quot;markup&quot;
                    }
                }
            }
        }
    }
</code></pre>
Here it is in SON:<p><pre><code>    {&quot;glossary&quot;:{&quot;GlossDiv&quot;:{&quot;GlossList&quot;:{&quot;GlossEntry&quot;:{&quot;Abbrev&quot;:&quot;ISO 8879:1986&quot;,&quot;Acronym&quot;:&quot;SGML&quot;,&quot;ID&quot;:&quot;SGML&quot;,&quot;GlossDef&quot;:{&quot;GlossSeeAlso&quot;:[&quot;GML&quot;,&quot;XML&quot;],&quot;para&quot;:&quot;A meta-markup language, used to create markup languages such as DocBook.&quot;},&quot;GlossSee&quot;:&quot;markup&quot;,&quot;GlossTerm&quot;:&quot;Standard Generalized Markup Language&quot;,&quot;SortAs&quot;:&quot;SGML&quot;}},&quot;title&quot;:&quot;S&quot;},&quot;title&quot;:&quot;example glossary&quot;}}
</code></pre>
Here it is in an advanced S-expression representation:<p><pre><code>    (glossary &quot;example glossary&quot;
              (div S
                   (entry SGML
                          (sort SGML)
                          (term &quot;Standard Generalized Markup Language&quot;)
                          (acronym SGML)
                          (abbrev &quot;ISO 8879:1986&quot;)
                          (def &quot;A meta-markup language, used to create markup languages such as DocBook.&quot;
                               (see-also GML XML))
                          (see markup))))
</code></pre>
And here it is in its canonical representation:<p><pre><code>    (8:glossary16:example glossary(3:div1:S(5:entry4:SGML(4:sort4:SGML)(4:term36:Standard Generalized Markup Language)(7:acronym4:SGML)(6:abbrev13:ISO 8879:1986)(3:def72:A meta-markup language, used to create markup languages such as DocBook.(8:see-also3:GML3:XML))(3:see6:markup))))
</code></pre>
What, you&#x27;d like something which is immune to 7-bit&#x2F;8-bit or email mangling?  Here&#x27;s the same data in transport format:<p><pre><code>    {KDg6Z2xvc3NhcnkxNjpleGFtcGxlIGdsb3NzYXJ5KDM6ZGl2MTpTKDU6ZW50cnk0OlNHTUwoNDpz
    b3J0NDpTR01MKSg0OnRlcm0zNjpTdGFuZGFyZCBHZW5lcmFsaXplZCBNYXJrdXAgTGFuZ3VhZ2Up
    KDc6YWNyb255bTQ6U0dNTCkoNjphYmJyZXYxMzpJU08gODg3OToxOTg2KSgzOmRlZjcyOkEgbWV0
    YS1tYXJrdXAgbGFuZ3VhZ2UsIHVzZWQgdG8gY3JlYXRlIG1hcmt1cCBsYW5ndWFnZXMgc3VjaCBh
    cyBEb2NCb29rLig4OnNlZS1hbHNvMzpHTUwzOlhNTCkpKDM6c2VlNjptYXJrdXApKSkp}
</code></pre>
All three of those S-expression formats can be <i>losslessly</i> converted to one another.  Ordering is exactly as specified (they are lists, not unordered or ordered dicts — although one can understand them as dicts, if desired).