tests/testthat/test-single-null.R

test_that("option 'single_null' works", {
  
  expect_identical(
    read_json_str('{"a":null,"b":3}'),
    list(a = NULL, b = 3L)
  )
  
  
  
  expect_identical(
    read_json_str('{"a":null,"b":3}', single_null = "hello"),
    list(a = "hello", b = 3L)
  )
  
})

Try the yyjsonr package in your browser

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

yyjsonr documentation built on June 8, 2025, 10:47 a.m.