Assume that we have two analytic functions $f(x,y)$ and $g(x,y)$ defined near $(0,0)$ on the plane. Let us also assume that $\nabla f =k \nabla J$, where $k=k(x,y)$ is also analytic and $\nabla f(0,0)\neq 0$, $\nabla g(0,0)\neq 0$.

Does it imply that there exists a locally defined analytic function h=h(u) of one variable, such that $g(x,y)=h(f(x,y))$ locally?

In the reverse direction the conclusion is easily checked using the chain rule.