code: def test_metrics_diff_json(tmp_dir, scm, dvc, run_copy_metrics):
      def _gen(val):
          metrics = {"a": {"b": {"c": val, "d": 1, "e": str(val)}}}
          (tmp_dir / "m_temp.json").dump(metrics)
          run_copy_metrics(
              "m_temp.json",
              "m.json",
              name="copy-metrics",
              metrics=["m.json"],
              commit=str(val),
          )
  
      _gen(1)
      _gen(2)
      _gen(3)
  
      expected = {
          "m.json": {
              "a.b.e": {"old": "1", "new": "3"},
              "a.b.c": {"old": 1, "new": 3, "diff": 2},
          }
      }
      assert dvc.metrics.diff(a_rev="HEAD~2") == {"diff": expected}
  
imports: import json
  from os.path import join
  import pytest
  from dvc.cli import main
  from dvc.utils import relpath
  from dvc.utils.serialize import JSONFileCorruptedError
label_desc: Use image node_id 3 for calling a global function with example usage: test_metrics_diff_json(tmp_dir, scm, dvc, run_copy_metrics) without return types