jsonlite
jsonlite copied to clipboard
A Robust, High Performance JSON Parser and Generator for R
I am trying to figure out if the time elapsed using `fromJSON` that I'm looking at is typical or a red flag; I apologize if that's not appropriate to raise...
You may want to add `...` to your functions so you can appropriately cascade to `jsonlite::prettify` The `indent` feature is not being passed ...
reprex: ``` r jsonlite::toJSON(list(x = 0), digits = NA) #> {"x":[0]} jsonlite::toJSON(list(x = 0+0i), digits = NA) #> Error in prettyNum(.Internal(format(x, trim, digits, nsmall, width, 3L, : invalid value -2147483648...
I have your object from the documentation: ``` {"type":"list","attributes":{"names":{"type":"character","attributes":{},"value":["mynull","mycomplex","mymatrix","myint","mydf","mylist","mylogical","mychar","somemissings","myrawvec"]}},"value":[{"type":"NULL"},{"type":"list","attributes":{"names":{"type":"character","attributes":{},"value":["values","vectors"]}},"value":[{"type":"complex","attributes":{},"value":["0.055+1.256i","0.055-1.256i","1.007+0i"]},{"type":"complex","attributes":{"dim":{"type":"integer","attributes":{},"value":[3,3]}},"value":["-0.179+0.16i","0.697+0i","0.134+0.662i","-0.179-0.16i","0.697+0i","0.134-0.662i","0.661+0i","-0.495+0i","-0.565+0i"]}]},{"type":"double","attributes":{"dim":{"type":"integer","attributes":{},"value":[3,3]}},"value":[-0.446,1.224,0.36,0.401,0.111,-0.556,1.787,0.498,-1.967]},{"type":"integer","attributes":{},"value":[1,2,3]},{"type":"list","attributes":{"names":{"type":"character","attributes":{},"value":["speed","dist"]},"class":{"type":"character","attributes":{},"value":["data.frame"]},"row.names":{"type":"integer","attributes":{},"value":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50]}},"value":[{"type":"double","attributes":{},"value":[4,4,7,7,8,9,10,10,10,11,11,12,12,12,12,13,13,13,13,14,14,14,14,15,15,15,16,16,17,17,17,18,18,18,18,19,19,19,20,20,20,20,20,22,23,24,24,24,24,25]},{"type":"double","attributes":{},"value":[2,10,4,22,16,10,18,26,34,17,28,14,20,24,28,26,34,34,46,26,36,60,80,20,26,54,32,40,32,40,50,42,56,76,84,36,46,68,32,48,52,56,64,66,54,70,92,93,120,85]}]},{"type":"list","attributes":{"names":{"type":"character","attributes":{},"value":["foo","","","",""]}},"value":[{"type":"character","attributes":{},"value":["bar"]},{"type":"double","attributes":{},"value":[123]},{"type":"logical","attributes":{},"value":[null]},{"type":"NULL"},{"type":"list","attributes":{},"value":[{"type":"character","attributes":{},"value":["test"]}]}]},{"type":"logical","attributes":{},"value":[true,false,null]},{"type":"character","attributes":{},"value":["foo",null,"bar"]},{"type":"double","attributes":{},"value":[1,2,"NA","NaN",5,"Inf","-Inf",9,"NA"]},{"type":"raw","attributes":{},"value":"VGhpcyBpcyBhIHRlc3Q="}]} ``` I go to https://jsonlint.com/ to validate: ``` { "type": "list", "attributes": { "names": { "type": "character", "attributes": {}, "value": ["mynull",...
Thank you for your great contribution to the R world, I am using jsonlite on a regular basis and it is a great tool. Nevertheless, I found a minor issue...
``` toJSON(list(x = 1, y = data.frame(a = 2, b = 3)), pretty = TRUE, auto_unbox = TRUE) { "x": 1, "y": [ { "a": 2, "b": 3 } ]...
This improves the runtime significantly for loading data with many columns. The order of loop nesting as well as a much more efficient binary search does the trick. In a...
I have Ubuntu 20.04 OS and my system locale is set to et_EE.UTF-8 (which means that in my system thousands are separated by space and decimals by ","). When I...
For an NA value in a lists column in a data frame, toJSON outputs an empty list (instead of nothing)
When using `toJSON()` on a data frame, default behavior for NA values is that no field is included in the JSON record (see also section 2.4.3 in _The jsonlite Package:...
Here is a quick sample which shows the bug: POSIXlt works as expected: ``` > time1 unbox(time1) [x] "2018-08-16 19:12:19" > ``` However, POSIXct fails > time1l unbox(time1l) Error: Only...