code: def _get_json_metadata_mapping(
      artifact_instance: artifact.Artifact,
  ) -> Dict[str, Any]:
      """Converts Artifact properties to a JSON dictionary."""
      properties_json = _get_json_value_mapping(
          artifact_instance.mlmd_artifact.properties
      )
      custom_properties_json = _get_json_value_mapping(
          artifact_instance.mlmd_artifact.custom_properties
      )
      metadata_dict = {}
      for key, value in properties_json.items():
          metadata_dict[key] = value
      for key, value in custom_properties_json.items():
          if key in artifact_instance.artifact_type.properties:
              key = artifact.CUSTOM_PROPERTIES_PREFIX + key
          metadata_dict[key] = value
      return metadata_dict
  
imports: import hashlib
  from typing import Any, Dict, List, Mapping, MutableMapping, Optional
  from absl import logging
  from kfp.pipeline_spec import pipeline_spec_pb2
  from tfx.components.evaluator import constants
  from tfx.orchestration.kubeflow.v2 import compiler_utils
  from tfx.types import artifact
  from tfx.types import artifact_utils
  from tfx.types import standard_component_specs
  from tfx.utils import import_utils
  import yaml
  from google.protobuf import struct_pb2
  from google.protobuf import json_format
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 8 for calling a global function with example usage: _get_json_metadata_mapping(artifact_instance) and returns: metadata_dict