json2html {cppcheckR} | R Documentation |
JSON to HTML
Description
Render a formatted JSON string in HTML.
Usage
json2html(
json,
outfile = NULL,
pandoc = FALSE,
style = paste0("background-color: #051C55; color: #E76900; ",
"font-size: 15px; font-weight: bold; margin: 0; ",
"white-space: pre-wrap; outline: #051C55 solid 10px;"),
keyColor = "crimson",
numberColor = "chartreuse",
stringColor = "lightcoral",
trueColor = "#00cc00",
falseColor = "#ff8080",
nullColor = "cornflowerblue"
)
Arguments
json |
a JSON string or a path to a JSON file |
outfile |
either a path to a html file, or |
pandoc |
Boolean, whether to use pandoc |
style |
some CSS for the container, only if |
keyColor |
color of the keys, only if |
numberColor |
color of the numbers, only if |
stringColor |
color of the strings, only if |
trueColor |
color of the |
falseColor |
color of the |
nullColor |
color of the |
Value
Nothing if outfile
is not NULL
, otherwise the HtML
as a character string.
Examples
library(cppcheckR)
xml <- system.file("extdata", "order-schema.xml", package = "xml2")
json <- xml2json(xml)
html <- json2html(json)
library(htmltools)
if(interactive()){
browsable(HTML(html))
}
# with pandoc
html <- json2html(json, pandoc = TRUE)
if(interactive()){
browsable(HTML(html))
}
[Package cppcheckR version 1.0.0 Index]