# Using command with optional arguments inside tikzcd arrows

I have defined a command for the jacobian matrix, such as follows

\newcommand{\Jacobian}[2][]{\operatorname{J}_{#1}{#2}}


The problem comes if I try to use it inside a tikzcd arrow, probably because of problems with interepreting the brackets. I want to write something like this:

\begin{tikzcd}
\mathbb{R}^{2} \arrow[r,"\Jacobian[p]{f}"] &
\mathbb{R}^{2}
\end{tikzcd}


And have an output as if I had typed

\begin{tikzcd}
\mathbb{R}^{2} \ar[r, "\operatorname{J}_{p}{f}"] &
\mathbb{R}^{2}
\end{tikzcd}


But if I try this, compilation fails with

ERROR: Argument of \tikz@quote@@parser has an extra }.

--- TeX said ---
<inserted text>
\par
l.152     \end{tikzcd}

--- HELP ---
From the .log file...

I've run across a }' that doesn't seem to match anything.
For example, \def\a#1{...}' and \a}' would produce
this error. If you simply proceed now, the \par' that
I've just inserted will cause me to report a runaway
argument that might be the root of the problem. But if
your }' was spurious, just type 2' and it will go away.


I tried putting braces in some reasonable places without success.

\begin{tikzcd}