tests/testthat/test-prettify.R

test_that("json_prettify works", {
  x <- c("[1,2,   3]", '{"a": 1, "b": 2}', NA)
  y <- c(
  "[1,
         2,   3]",
  '{"a":     1, "b": 2}',
  NA
  )

  expect_snapshot(json_prettify(x))
  expect_snapshot(json_prettify(y))

  expect_snapshot(json_minify(x))
  expect_snapshot(json_minify(y))
})

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.