  We study inverse problems for the nonlinear wave equation $\square_g u +
w(x,u, \nabla_g u) = 0$ in a Lorentzian manifold $(M,g)$ with boundary, where
$\nabla_g u$ denotes the gradient and $w(x,u, \xi)$ is smooth and quadratic in
$\xi$. Under appropriate assumptions, we show that the conformal class of the
Lorentzian metric $g$ can be recovered up to diffeomorphisms, from the
knowledge of the Neumann-to-Dirichlet map. With some additional conditions, we
can recover the metric itself up to diffeomorphisms. Moreover, we can recover
the second and third quadratic forms in the Taylor expansion of $w(x,u, \xi)$
with respect to $u$ up to null forms.
