davisp commented on issue #1425:
URL: 
https://github.com/apache/couchdb-fauxton/issues/1425#issuecomment-1887678390

   > That means it's treating the JSON as a sequence of characters which is 
exactly what it is,
   > without converting to any specific machine representation for numbers.
   
   This isn't true. Its just that Jiffy (CouchDB's JSON parser) is capable of 
handling bignums easily since Erlang has bignum support built in.
   
   This works by detecting when it successfully parses a number (i.e., we found 
a string that matches JSON grammar) but isn't capable of storing the value in a 
native type. When that happens, we set a flag and wrap the sub-binary with a 
tagged tuple that is then processed in Erlang.
   
   The logic in C can be found here:
   
   
https://github.com/davisp/jiffy/blob/9ea1b35b6e60ba21dfd4adbd18e7916a831fd7d4/c_src/decoder.c#L588-L617
   
   And then when the parsed JSON value is passed back to Erlang we run this 
function over it to get real bignums:
   
   https://github.com/davisp/jiffy/blob/master/src/jiffy.erl#L111-L142
   
   That said, if you're working with large numbers you'll want to either ensure 
that your JSON parser has bignum support, or follow @nickva's advice and store 
your numbers as strings to be interpreted at the application level.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@couchdb.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to