[
https://issues.apache.org/jira/browse/COUCHDB-1407?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13207022#comment-13207022
]
Paul Joseph Davis commented on COUCHDB-1407:
--------------------------------------------
As mentioned on the dev@ thread, I'm pretty dead set against this approach.
While there seems to be some sort of general consensus that storing numbers as
uninterpreted bytes and repeating them back is the way to go it really misses
the entirety of the issue.
First, CouchDB has never claimed to pass numbers around while keeping byte
identical representations. This patch attempts to change that drastically with
a very large number of consequences that we haven't begun to investigate.
Secondly, if we were to actually consider going this route then we'd also be
obliged to start looking at every other place where we change representations
internally as well.
Thirdly, if we were to do that then we'd also have to get into all of the cases
where we're stricter than JSON specifically allows and then try and address all
of those issues as well.
Basically, how about we just fix the encoder to spit out a decimal point and an
appropriate amount of precision and then start documenting our round tripping
limitations.
> JSON encoding of number changes
> -------------------------------
>
> Key: COUCHDB-1407
> URL: https://issues.apache.org/jira/browse/COUCHDB-1407
> Project: CouchDB
> Issue Type: Bug
> Components: HTTP Interface
> Affects Versions: 1.2
> Environment: Ubuntu 12.04 (alpha)
> Reporter: Adam Lofts
> Attachments: 0001-Only-validate-numbers-on-JSON-decoding.patch
>
>
> JSON encoding of Number has changed from 1.0.2 to 1.2. JSON only defines
> Number but this change causes issues in my app because python decodes the
> number as an int in 1.2.
> Test case:
> PORT=5985
> curl -X DELETE http://localhost:$PORT/test-floats/
> curl -X PUT http://localhost:$PORT/test-floats/
> curl -X PUT http://localhost:$PORT/test-floats/doc1 -H "Content-Type:
> application/json" -d "{ \"a\": 1.0 }"
> curl http://localhost:$PORT/test-floats/doc1
> Run against 1.0.2:
> {"ok":true}
> {"ok":true}
> {"ok":true,"id":"doc1","rev":"1-78e61304147429d3d500aee7806fd26d"}
> {"_id":"doc1","_rev":"1-78e61304147429d3d500aee7806fd26d","a":1.0}
> Run against 1.2:
> {"ok":true}
> {"ok":true}
> {"ok":true,"id":"doc1","rev":"1-78e61304147429d3d500aee7806fd26d"}
> {"_id":"doc1","_rev":"1-78e61304147429d3d500aee7806fd26d","a":1}
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira