W3C home > Mailing lists > Public > public-interledger@w3.org > November 2016

Re: TJSON

From: Manu Sporny <msporny@digitalbazaar.com>
Date: Thu, 3 Nov 2016 21:47:05 -0400
To: public-interledger@w3.org
Message-ID: <581BE899.5000909@digitalbazaar.com>
On 11/03/2016 02:15 PM, Stefan Thomas wrote:
> {
>   "count": 5,
>   "key:b64":  "AANFJzysAFsbashj==",
>   "message": "Hello!"
> }

Just to chime in from a JSON-LD perspective, we had microsyntaxes in a
/very early/ version of JSON-LD and abandoned them because they
annoyed developers.

Tony, Christopher Allen, and I have exchanged a few messages on Twitter
today about this:

https://twitter.com/bascule/status/793989414112198656

I think we ended up agreeing that microsyntaxes are ok as long as
99.999% of developers never have to see or use them. For example, TJSON
as an intermediate format is okay for the same reason that NQuads is an
okay format for Linked Data Signatures - almost no developers (save for
the parser implementers) have to effectively learn a new domain specific
language to take advantage of the features.

This is how we solve the problem above in JSON-LD - you define the value
associated with key to be of type Base64Binary in a context like
"https://example.org/helloworld/v1", like so:

"key": {
  "@id": "https://example.org/helloworld#key",
  "@type": "xsd:base64Binary",
}

and then you use it in your data, like so:

{
  "@context": "https://example.org/helloworld/v1",
  "count": 5,
  "key": "AANFJzysAFsbashj==",
  "message": "Hello!"
}

So, you get easy to read/parse/use JSON with the added benefit of strong
typing.

-- manu

-- 
Manu Sporny (skype: msporny, twitter: manusporny, G+: +Manu Sporny)
Founder/CEO - Digital Bazaar, Inc.
blog: Rebalancing How the Web is Built
http://manu.sporny.org/2016/rebalancing/
Received on Friday, 4 November 2016 01:47:35 UTC

This archive was generated by hypermail 2.3.1 : Friday, 4 November 2016 01:47:36 UTC