% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/insightmaker_conv.R
\name{insightmaker_to_json}
\alias{insightmaker_to_json}
\title{Convert .InsightMaker file to .json file}
\usage{
insightmaker_to_json(url, file, destfile = NULL)
}
\arguments{
\item{url}{URL to Insight Maker model. Character.}

\item{file}{File path to Insight Maker model. Only used if url is not specified. Needs to be a character with suffix .InsightMaker.}

\item{destfile}{Output file path. Must have extension .json or no extension. Overwrites file if it already exists. If not provided, return model in json format.}
}
\value{
If destfile is not provided; object of class "json". If destfile provided, invisibly returns destfile (character string).
}
\description{
Import and convert a stock-and-flow model from \href{https://insightmaker.com/}{Insight Maker} to a .json file. Models may be your own or another user's. Importing causal loop diagrams or agent-based models is not supported.
}
\details{
Insight Maker models can be imported using a URL or Insight Maker file. Ensure the URL refers to a public (not private) model. To download a model file from Insight Maker, first clone the model if it is not your own. Then, go to "Share" (top right), "Export", and "Download Insight Maker file".
}
\examples{
\dontshow{if (has_internet() && Sys.getenv("NOT_CRAN") == "true") withAutoprint(\{ # examplesIf}
# Convert a model from Insight Maker to json
destfile <- tempfile(fileext = ".json")
json <- insightmaker_to_json(
  url =
    "https://insightmaker.com/insight/43tz1nvUgbIiIOGSGtzIzj/Romeo-Juliet",
  destfile = destfile
)
file.remove(destfile)
\dontshow{\}) # examplesIf}
}
\concept{importExport}
