couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Anderson <>
Subject Re: Canonical JSON [Proposal for digital signatures of documents]
Date Wed, 11 Mar 2009 02:32:49 GMT
On Tue, Mar 10, 2009 at 5:37 AM, Kerr Rainey <> wrote:
> 2009/3/9 Noah Slater <>:
>> My company produce price feeds using decimals, and we need those decimals to be
>> decimals. For that reason, and after much messing about and research, I decided
>> that we should use strings for all non-int numerical values. I would be
>> supportive of a canonicalisation format that followed this rationale.
> I've had good results using a scheme where decimals are made up of
> pairs of ints, the first representing a coefficient and the second a
> power of 10.  Basically calculator e notation, but with an integer
> instead of a float, adjusted accordingly.

I like this idea - I wonder if we can get serialize it to a valid JSON
string - I think 235e-2 works ... checking.... yes it does!

I've started working on a butchering of json2.js that gives a
canonical form for a given JavaScript object. I'm doing test-driven
development, and so far I've got it passing just a few of the basics.
(And the float handling is not as good as Kerr's).

You can run the tests here - ignore the messiness of my copy of Futon,
those spinners will never stop.

The source code is at

I bet we can get this thing working this week!


Chris Anderson

View raw message