code: def test_show_json(mocker, capsys):
      cli_args = parse_args(["list", "local_dir", "--json"])
      assert cli_args.func == CmdList
  
      cmd = cli_args.func(cli_args)
  
      result = [{"key": "val"}]
      mocker.patch("dvc.repo.Repo.ls", return_value=result)
  
      assert cmd.run() == 0
      out, _ = capsys.readouterr()
      assert json.dumps(result) in out
  
file_path: dvc/tests/unit/command/ls/test_ls.py
imports: import json
  from dvc.cli import parse_args
  from dvc.commands.ls import CmdList
label_desc: Use image node_id 8 for calling a global function with example usage: test_show_json(mocker, capsys) without return types