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

Re: TJSON

From: Anders Rundgren <anders.rundgren.net@gmail.com>
Date: Thu, 3 Nov 2016 10:32:21 +0100
To: Adrian Hope-Bailie <adrian@hopebailie.com>, Interledger Community Group <public-interledger@w3.org>
Message-ID: <2e1b3e90-794f-f700-4bda-4735fa1d6168@gmail.com>
On 2016-11-03 09:32, Adrian Hope-Bailie wrote:
> For those of you that were on yesterdays call and part of the discussion around encoding formats here's a another to throw in the ring courtesy of a member of this community, Toni Arcieri.
>
> https://tonyarcieri.com/introducing-tjson-a-stricter-typed-form-of-json
>
> Looks like an interesting option for verbose text encoding of crypto-conditions (for dev and test)...

I don't see the point with introducing a version of JSON that makes strings look like "s:Hello world".
Wouldn't it be more logical to start over from scratch?

All mentioned features and some more are supported by yours truly's JSON tools on GitHub (https://github.com/cyberphone/openkeystore/tree/master/library/src/org/webpki/json) and that without changing anything in JSON.

Doc: http://webpki.org/papers/keygen2/doc/org/webpki/json/JSONObjectReader.html

If you for example would like to use financial number you would use BigDecimals you would for write do

           jsonwriter.setBigDecimal("amount", bigdecimalvalue[, decimals);

while reading

           bigdecimalvalue = jsonreader.getBigDecimal("amount"[,decimals);

That the values are represented a ordinary JSON strings like "599.25" doesn't matter, because the parser will reject anything that doesn't fit the type in question.

That is, getInt("myval") would reject 1.0 because it is not an integer.

IMO the ES6 specification addresses canonicalization (including property order...) good enough.  Add typing on top of that and you're done.

Anders
Received on Thursday, 3 November 2016 09:32:56 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 3 November 2016 09:32:57 UTC