Almost the same as \mbox{\hyperlink{md_sfcode_node_modules_fs_extra_docs_writeJson_sync}{\`{}write\+Json\+Sync\`{}}}, except that if the directory does not exist, it\textquotesingle{}s created.

{\bfseries{Alias\+:}} {\ttfamily output\+JSONSync()}


\begin{DoxyItemize}
\item {\ttfamily file} {\ttfamily $<$String$>$}
\item {\ttfamily object} {\ttfamily $<$Object$>$}
\item {\ttfamily options} {\ttfamily $<$Object$>$}
\begin{DoxyItemize}
\item {\ttfamily spaces} {\ttfamily $<$Number$\vert$\+String$>$} Number of spaces to indent; or a string to use for indentation (i.\+e. pass `'\textbackslash{}t\textquotesingle{}{\ttfamily for tab indentation). See \mbox{[}the docs\mbox{]}(\href{https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify}{\texttt{ https\+://developer.\+mozilla.\+org/en-\/\+US/docs/\+Web/\+Java\+Script/\+Reference/\+Global\+\_\+\+Objects/\+JSON/stringify}}\#The\+\_\+space\+\_\+argument) for more info. -\/}EOL$<$\+String$>${\ttfamily Set EOL character. Default is}~\newline
{\ttfamily . -\/}replacer{\ttfamily \mbox{[}JSON replacer\mbox{]}(\href{https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify}{\texttt{ https\+://developer.\+mozilla.\+org/en-\/\+US/docs/\+Web/\+Java\+Script/\+Reference/\+Global\+\_\+\+Objects/\+JSON/stringify}}\#The\+\_\+replacer\+\_\+parameter)}
\item {\ttfamily Also accepts \mbox{[}}fs.\+write\+File\+Sync\`{} options\mbox{]}(\href{https://nodejs.org/api/fs.html\#fs_fs_writefilesync_file_data_options}{\texttt{ https\+://nodejs.\+org/api/fs.\+html\#fs\+\_\+fs\+\_\+writefilesync\+\_\+file\+\_\+data\+\_\+options}})
\end{DoxyItemize}
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_fs_extra_docs_outputJson_sync_autotoc_md11026}{}\doxysection{Example\+:}\label{md_sfcode_node_modules_fs_extra_docs_outputJson_sync_autotoc_md11026}

\begin{DoxyCode}{0}
\DoxyCodeLine{const fs = require('fs-\/extra')}
\DoxyCodeLine{}
\DoxyCodeLine{const file = '/tmp/this/path/does/not/exist/file.json'}
\DoxyCodeLine{fs.outputJsonSync(file, \{name: 'JP'\})}
\DoxyCodeLine{}
\DoxyCodeLine{const data = fs.readJsonSync(file)}
\DoxyCodeLine{console.log(data.name) // => JP }

\end{DoxyCode}
 