tests/testthat/test-serializeJSON-datasets.R

#test serializeJSON



# Note about numeric precision
# In the unit tests we use digits=10. Lowever values will result in problems for some datasets
test_that("Serializing datasets", {
  library(datasets);
  lapply(as.list(ls("package:datasets")), function(x){
    mycall <- call("expect_equal",
      call("unserializeJSON", call("serializeJSON", as.name(x), digits=10)),
      as.name(x)
    );
    eval(mycall)
  });
});

Try the jsonlite package in your browser

Any scripts or data that you put into this service are public.

jsonlite documentation built on June 22, 2024, 11:05 a.m.