Monte Goulding's day off? ; -) the outcome.

Mark Waddingham mark at livecode.com
Fri Jul 1 05:33:43 EDT 2016


On 2016-07-01 11:26, Monte Goulding wrote:
> From the perspective of mergJSON it would be simpler to convert it to
> lcidl based and therefore set variables to specific data types than to
> do what you are suggesting here as there’s simply no access to the
> strings from Jannson.

Indeed - that would put it in the same class of operation as the LCB 
JSON library.

To be fair, I *suspect* the outcome would be entirely equivalent for any 
use of the input data where the numberFormat is configured to show less 
than around 15 decimal d.p. - which you should never exceed anyway, 
since that's the limit of what can be represented without error.

The main reason the 'decimal-as-string' idea might be 'nice' is that it 
allows faithful roundtripping of values in a JSON array. For example, if 
your program is only processing parts of an array generated from a JSON 
file and then writing it back out again, at the moment all numbers would 
get reformated as though they'd been round-tripped through doubles, if 
the conversion to double is done lazily (i.e. only if they are processed 
and set again) then only the parts of the file which need to change do 
change. (Of course, the structure of the JSON file in terms of 
whitespace wouldn't be preserved, however it would mean that the file as 
a whole would be stable apart from modified values after the first time 
it was passed through the processing program).

Warmest Regards,

Mark.

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps




More information about the use-livecode mailing list