How to write a block matrix in Latex in the following way:

I wrote the following code:
\[
Q=\left[
\begin{array}{c c c c}
\textbf{nI}& \vline & \textbf{J}\\
\hline
\textbf{J^T} &\vline &\textbf{K}
\end{array}
\right]
\]
I am getting the following error:
! Extra }, or forgotten $.\textdef@ ...th {#1}\let \f@size #2\selectfont #3}} \textbf{J^T}
and many more errors which are difficult to put here.
Can someone kindly help.


\mathbf{A}. – Werner Aug 16 '19 at 05:15