Add filename to --dump-json output (Fixes #1908)