tests/testthat/test-format_json.R

test_that("format_json works", {
  expect_equal(
    format_json(list(a = 1, b = "x")),
    new_json2('{"a":[1],"b":["x"]}')
  )
})

test_that("format_json_list works", {
  expect_equal(
    format_json_list(list(a = 1, b = "x")),
    new_json2(c(a = "[1]", b = '["x"]'))
  )
})

Try the jsontools package in your browser

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

jsontools documentation built on March 22, 2021, 5:06 p.m.