print_json_class | R Documentation |
This function powers the json_class
and json_vec
specific methods of the
base generic base::print()
. As it is applied recursively and recursion
depth has to be controllable, the function is aware of both the current
recursion depth (via cur_depth
) and the maximally allowed recursion depth
(via max_depth
). Furthermore the printing style (colored output and UTF
box characters for visualizing the tree structure) can be controlled through
the layout
argument. Under some circumstances, this requires a given node
to know whether the parent node is a named object or not, which is passed
from a parent node to its children through the unnamed_parent
argument.
In order to enable fancy printing (colored output and UTF box characters
for visualizing the tree structure), this function provides the required
styling information. Fancy printing can be disabled by setting the fancy
argument to FALSE
, which yields ASCII characters for the tree structure
and disables color. This was more or less directly copied from Hadley's
lobstr package.
print_json_class(x, unnamed_parent = FALSE, cur_depth, max_depth, layout = style()) style(fancy = TRUE)
x |
The JSON object to print. |
unnamed_parent |
Whether the parent node is named or not (in some cases, a different box character has to be used if this is true). |
cur_depth |
The current recursion depth. |
max_depth |
The maximum recursion depth. |
layout |
Characters for printing the tree structure and styles to be applied to the different entities. |
fancy |
Logical switch to enable font styles, colors and UTF box characters. |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.