Closed atheriel closed 6 years ago
Hmm I really don't like that the new spec wraps every integer and number is now wrapped in another object. This creates a lot of overhead, and in R we rarely distinguish these types.
"Int32": {
"$numberInt": "42"
},
"Int64": {
"$numberLong": "42"
},
"Double": {
"$numberDouble": "42.42"
},
If we switch I think I would prefer the 'relaxed' extended json.
Do you mean in terms of the R objects generated? If so, I definitely favour efficiency. Otherwise I think this change only applies to generating JSON strings -- and there it might make more sense to favour correctness.
I really don't like how inserting some data from R and then exporting it blows up the json because each value is wrapped in "$numberDouble": "42.42"
. This blows up the format and kills the interoperability, which defeats the purpose of JSON.
Generally I don't think R users care about this. In R all numbers get silently coerced to doubles. Hence I prefer the "relaxed" format which I think is more in line with the R philosophy.
Makes sense to me. :+1:
As discussed in jeroen/jsonlite#247,
mongolite
is currently producing so-called "legacy" extended JSON in some places. This commit moves existing uses ofbson_as_json()
tobson_as_canonical_extended_json()
in an effort to resolve this.