# How to use bracket symbol in node name in forest?

\documentclass{article}
\usepackage{forest}

\begin{document}
\begin{forest}
[Z [$K[2]$] ]
\end{forest}
\end{document}


How can I use brackets in a node name? Not necessarily inside math. The above just yiels weird errors.

From page 4 of the forest documentation or Ex. (4), "If you need a square bracket as part of a node’s content, use braces." To view the documentation for a package, try texdoc <package name> from a command line.
\documentclass{article}
[Z [{$K[2]$}] ]