code: def _build_dag_json(
      components: Dict[str, "ModelComponent"],
      ep_proto: Optional["EndpointProtocol"],
      *,
      show_connected_components: bool = True,
  ):
      if show_connected_components is True:
  
          def dag_json():
              return merged_dag_content(ep_proto, components).dict()
  
      else:
  
          def dag_json():
              return component_dag_content(components).dict()
  
      return dag_json
  
file_path: lightning-flash/src/flash/core/serve/interfaces/http.py
imports: import base64
  import uuid
  from io import BytesIO
  from pathlib import Path
  from typing import TYPE_CHECKING, Any, Callable, Dict, Optional
  from flash.core.serve.dag.task import get
  from flash.core.serve.dag.visualize import visualize
  from flash.core.serve.execution import ComponentJSON, MergedJSON, TaskComposition, build_composition, component_dag_content, merged_dag_content
  from flash.core.serve.interfaces.models import Alive, EndpointProtocol
  from flash.core.utilities.imports import _CYTOOLZ_AVAILABLE, _FASTAPI_AVAILABLE
label_desc: Use image node_id 5 for calling a global function with example usage: _build_dag_json(components, ep_proto) and returns: dag_json, merged_dag_content, component_dag_content