% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ts-tree-unserialize.R
\name{ts_tree_unserialize}
\alias{ts_tree_unserialize}
\title{Unserialize selected elements of a tree-sitter tree}
\usage{
ts_tree_unserialize(tree)
}
\arguments{
\item{tree}{A \code{ts_tree} object.}
}
\value{
List of R objects, with one entry for each selected element.
}
\description{
Unserialize the selected elements of a \code{ts_tree} object, i.e. convert
them to R objects.
}
\details{
If no elements are selected in the tree, then the whole document is
unserialized.

If the tree has an empty selection, then an empty list is returned.
\subsection{The \code{[[} operator}{

The \code{[[} operator works similarly to the combination of
\code{\link[tsitter:ts_tree_select]{ts_tree_select()}} and
\code{ts_tree_unserialize()}, but it might be more readable.

For the details on how the selected elements are mapped to R objects,
see the documentation of the methods in the parser packages. The methods
in the installed parser packages are linked below.
}
}
\examples{
\dontshow{if (requireNamespace("tsjsonc", quietly = TRUE)) withAutoprint(\{ # examplesIf}
# Create a parse tree with tsjsonc -------------------------------------
tree <- tsjsonc::ts_parse_jsonc('{"a": 13, "b": [1, 2, 3], "c": "x"}')

tree

ts_tree_unserialize(ts_tree_select(tree, c("b", "c")))

ts_tree_unserialize(ts_tree_select(tree, "b"))
\dontshow{\}) # examplesIf}
}
\seealso{
Other ts_tree generics:
\code{\link[=[[.ts_tree]{[[.ts_tree()}},
\code{\link[=[[<-.ts_tree]{[[<-.ts_tree()}},
\code{\link[=format.ts_tree]{format.ts_tree()}},
\code{\link[=print.ts_tree]{print.ts_tree()}},
\code{\link{select-set}},
\code{\link[=ts_tree_ast]{ts_tree_ast()}},
\code{\link[=ts_tree_delete]{ts_tree_delete()}},
\code{\link[=ts_tree_dom]{ts_tree_dom()}},
\code{\link[=ts_tree_format]{ts_tree_format()}},
\code{\link[=ts_tree_insert]{ts_tree_insert()}},
\code{\link[=ts_tree_new]{ts_tree_new()}},
\code{\link[=ts_tree_query]{ts_tree_query()}},
\code{\link[=ts_tree_select]{ts_tree_select()}},
\code{\link[=ts_tree_sexpr]{ts_tree_sexpr()}},
\code{\link[=ts_tree_update]{ts_tree_update()}},
\code{\link[=ts_tree_write]{ts_tree_write()}}

Other serialization functions:
\code{\link[=[[.ts_tree]{[[.ts_tree()}}
}
\concept{serialization functions}
\concept{ts_tree generics}
