# ---------------------------------------------------------------------------- #
#' Concatenate stringified JSON
#'
#' Strips 'stringified' JSON of newlines and spaces following colons or commas.
#'
#' @param txt The string of stringified JSON to be concatenated.
#'
#' @returns A string (stringified JSON), stripped of any newlines and spaces
#' following colons or commas.
#'
#' @examples
#' cat_json_str("{\n 'v1': [20],\n 'v2': [1.5]\n }")
#'
#' @export
#'
cat_json_str <- function(txt) {
pattern_repl <- c("\n *" = "", ": " = ":", ", +\"" = ",\"")
stringr::str_replace_all(txt, pattern_repl)
}
# ---------------------------------------------------------------------------- #
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.