% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/export.R
\name{pv_to_json}
\alias{pv_to_json}
\title{Export profiling results as JSON}
\usage{
pv_to_json(
  x,
  file = NULL,
  pretty = TRUE,
  include = c("summary", "self_time", "total_time", "hot_lines", "memory", "gc_pressure",
    "suggestions", "recursive"),
  system_info = FALSE
)
}
\arguments{
\item{x}{A profvis object.}

\item{file}{Optional file path to write JSON to. If \code{NULL}, returns the
JSON string.}

\item{pretty}{If \code{TRUE}, formats JSON with indentation for readability.}

\item{include}{Character vector specifying which analyses to include.
Options: "summary", "self_time", "total_time", "hot_lines", "memory",
"callers", "gc_pressure", "suggestions", "recursive". Default includes all.}

\item{system_info}{If \code{TRUE}, includes R version and platform info in
metadata. Useful for reproducibility.}
}
\value{
If \code{file} is \code{NULL}, returns a JSON string. Otherwise writes to file
and returns the file path invisibly.
}
\description{
Exports profiling analysis results in JSON format for consumption by
AI agents, automated tools, or external applications.
}
\examples{
p <- pv_example()
json <- pv_to_json(p)
cat(json)

# Include only specific analyses
json <- pv_to_json(p, include = c("self_time", "hot_lines"))

# Include system info for reproducibility
json <- pv_to_json(p, system_info = TRUE)

}
