% This LaTeX document was generated using the LaTeX backend of PlDoc, % The SWI-Prolog documentation system \subsection{library(term_to_json)} \label{sec:termtojson} \begin{description} \predicate[det]{term_to_json}{3}{+Term, +Bindings, -JsonTerm} \nodescription \predicate[det]{term_to_json}{2}{+Term, -JsonTerm} Convert any general Prolog term into a JSON term. Prolog lists are treated in a special way. Also, JSON terms are not converted. Mapping: \begin{itemize} \item Variable: \verb${"type":"var", "name":}$ \item Atom: \verb${"type":"atom", "value":}$ \item Integer: \verb${"type":"integer", "value":}$ \item Float: \verb${"type":"float", "value":}$ \item List: JSON array \item Dict: a JSON object. Values are processed recursively. (the tag is ignored) \item \verb$json([Key=Value, ...])$: a JSON object Values are processed recursively. \item compound: \verb${"type":"compound", "functor":, "args":}$ \end{itemize} \begin{arguments} \arg{Bindings} & is a list of Name=Var terms for variables that get their name from the environment. \\ \end{arguments} \end{description}