JSON-Based Universal Messaging Format (2017)
I&#x27;ll just note, once again, how verbose, unattractive &amp; difficult to parse JSON is compared to S-expressions.  Here are several of the examples in the spec in both formats, in order (I&#x27;ve rearranged the field so that required fields come first &amp; optional fields come later).<p>2.1:<p><pre><code>    {
      &quot;mid&quot;: &quot;ef5a7369-f0b9-4143-a49d-2b9c7ee51117&quot;,
      &quot;rmid&quot;: &quot;66c61afc-037b-4229-ace4-5ec4d788903e&quot;,
      &quot;to&quot;: &quot;uid:123&quot;,
      &quot;from&quot;: &quot;uid:56&quot;,
      &quot;type&quot;: &quot;dm&quot;,
      &quot;version&quot;: &quot;UMF&#x2F;1.4.3&quot;,
      &quot;priority&quot;: &quot;10&quot;,
      &quot;timestamp&quot;: &quot;2013-09-29T10:40Z&quot;,
      &quot;body&quot;: {
        &quot;message&quot;: &quot;How is it going?&quot;
      }
    }

    (message
     ef5a7369-f0b9-4143-a49d-2b9c7ee51117
     (to uid:123)
     (from uid:56)
     (version SMF&#x2F;1.4.3)
     (timestamp 2013-09-29T10:40Z)
     (rmid 66c61afc-037b-4229-ace4-5ec4d788903e)
     (type dm)
     (priority 10)
     (body
      (message &quot;How is it going?&quot;)))
</code></pre>
2.2.11:<p><pre><code>    {
      &quot;mid&quot;: &quot;ef5a7369-f0b9-4143-a49d-2b9c7ee51117&quot;,
      &quot;to&quot;: &quot;uid:56&quot;,
      &quot;from&quot;: &quot;game:store&quot;,
      &quot;version&quot;: &quot;UMF&#x2F;1.3&quot;,
      &quot;timestamp&quot;: &quot;2013-09-29T10:40Z&quot;,
      &quot;body&quot;: {
        &quot;type&quot;: &quot;store:purchase&quot;,
        &quot;itemID&quot;: &quot;5x:winnings:multiplier&quot;,
        &quot;expiration&quot;: &quot;2014-02-10T10:40Z&quot;
      }
    }

    (message
     ef5a7369-f0b9-4143-a49d-2b9c7ee51117
     (to uid:56)
     (from game:store)
     (version UMF&#x2F;1.3)
     (timestamp 2013-09-29T10:40Z)
     (body (type store:purchase)
           (itemID &quot;5x:winnings:multiplier&quot;)
           (expiration 2014-02-10T10:40Z)))
</code></pre>
2.2.11.2<p>Note how JSON has to rely on metadata to indicate that a Base64 sequence, whereas it&#x27;s natively supported by canonical S-expressions.  Note also how the S-expression format natively supports types (&#x27;display hints&#x27;) for its values.<p><pre><code>    {
      &quot;mid&quot;: &quot;ef5a7369-f0b9-4143-a49d-2b9c7ee51117&quot;,
      &quot;to&quot;: &quot;uid:134&quot;,
      &quot;from&quot;: &quot;uid:56&quot;,
      &quot;version&quot;: &quot;UMF&#x2F;1.3&quot;,
      &quot;timestamp&quot;: &quot;2013-09-29T10:40Z&quot;,
      &quot;body&quot;: {
        &quot;type&quot;: &quot;private:message&quot;,
        &quot;contentType&quot;: &quot;text&#x2F;plain&quot;,
        &quot;base64&quot;: &quot;SSBzZWUgeW91IHRvb2sgdGhlIHRyb3VibGUgdG8gZGVjb2RlIHRoaXMgbWVzc2FnZS4=&quot;
      }
    }

    (message
     ef5a7369-f0b9-4143-a49d-2b9c7ee51117
     (to uid:134)
     (from uid:56)
     (version SMF&#x2F;1.3)
     (timestamp 2013-09-29T10:40Z)
     (body
      (type private:message)
      [text&#x2F;plain]|SSBzZWUgeW91IHRvb2sgdGhlIHRyb3VibGUgdG8gZGVjb2RlIHRoaXMgbWVzc2FnZS4=|))
</code></pre>
2.2.11.3<p>One might expect that S-expressions might shine when it comes to sending multiple items, and of course one would be correct.<p>Also note how the parallel structure of the message &amp; message&#x2F;body&#x2F;message objects raises the question of whether the message&#x2F;body&#x2F;message schema should also be UMF.<p><pre><code>    {
      &quot;mid&quot;: &quot;ef5a7369-f0b9-4143-a49d-2b9c7ee51117&quot;,
      &quot;to&quot;: &quot;uid:134&quot;,
      &quot;from&quot;: &quot;chat:room:14&quot;,
      &quot;version&quot;: &quot;UMF&#x2F;1.3&quot;,
      &quot;timestamp&quot;: &quot;2013-09-29T10:40Z&quot;,
      &quot;body&quot;: {
        &quot;type&quot;: &quot;chat:messages&quot;,
        &quot;messages&quot;: [
          {
            &quot;from&quot;: &quot;moderator&quot;,
            &quot;text&quot;: &quot;Susan welcome to chat Nation NYC&quot;,
            &quot;ts&quot;: &quot;2013-09-29T10:34Z&quot;
          },
          {
            &quot;from&quot;: &quot;uid:16&quot;,
            &quot;text&quot;: &quot;Rex, you are one lucky SOB!&quot;,
            &quot;ts&quot;: &quot;2013-09-29T10:30Z&quot;
          },
          {
            &quot;from&quot;: &quot;uid:133&quot;,
            &quot;text&quot;: &quot;Rex you&#x27;re going down this next round&quot;,
            &quot;ts&quot;: &quot;2013-09-29T10:31Z&quot;
          }
        ]
      }
    }

    (message
     ef5a7369-f0b9-4143-a49d-2b9c7ee51117
     (to uid:134)
     (from chat:room:14)
     (version SMF&#x2F;1.3)
     (timestamp 2013-09-29T10:40Z)
     (body
      (type chat:messages)
      (messages 
       (message
        (from moderator)
        (text &quot;Susan welcome to chat Nation NYC&quot;)
        (ts 2013-09-29T10:34Z))
       (message
        (from uid:16)
        (text &quot;Rex, you are one lucky SOB!&quot;)
        (ts 2013-09-29T10:30Z))
       (message
        (from uid:133)
        (text &quot;Rex you&#x27;re going down this next round&quot;)
        (ts 2013-09-29T10:31Z)))))
</code></pre>
2.2.17<p>Note that there is a complex canonicalisation procedure for the JSON object, and that the sender must mutate the signed object; by contrast, the S-expression format is properly layered and doesn&#x27;t mutate signed objects (which implies that it&#x27;s possible to chain signatures cleanly).<p><pre><code>    {
      &quot;mid&quot;: &quot;ef5a7369-f0b9-4143-a49d-2b9c7ee51117&quot;,
      &quot;to&quot;: &quot;uid:123&quot;,
      &quot;from&quot;: &quot;uid:56&quot;,
      &quot;version&quot;: &quot;UMF&#x2F;1.4.6&quot;,
      &quot;signature&quot;: &quot;c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e&quot;,
      &quot;body&quot;: {}
    }

    (signature
     (message
      ef5a7369-f0b9-4143-a49d-2b9c7ee51117
      (to uid:123)
      (from uid:56)
      (version SMF&#x2F;1.4.6)
      (body))
     |c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e|)
</code></pre>
It&#x27;s not to late to switch away from JSON, it really isn&#x27;t.