code: def _serialize_to_json(input_data):
      # imported inside function to avoid circular import
      from mlflow.pyfunc.scoring_server import (
          SUPPORTED_FORMATS,
          SUPPORTED_LLM_FORMAT,
      )
  
      if isinstance(input_data, dict) and any(
          key in input_data
          for key in SUPPORTED_FORMATS | {SUPPORTED_LLM_FORMAT}
      ):
          return json.dumps(input_data)
      else:
          original_input_data = input_data
  
          if isinstance(
              input_data, (datetime, bool, bytes, float, int, str)
          ):
              input_data = [input_data]
  
          input_data = dump_input_data(input_data)
  
          _logger.info(
              f"Your input data has been transformed to comply with the expected input format for "
              "the MLflow scoring server. If you want to deploy the model to online serving, make "
              "sure to apply the same preprocessing in your inference client. Please also refer to "
              "https://www.mlflow.org/docs/latest/deployment/deploy-model-locally.html#json-input "
              "for more details on the supported input format."
              f"\n\nOriginal input data:\n{original_input_data}"
              f"\n\nTransformed input data:\n{input_data}"
          )
          return input_data
  
file_path: mlflow/mlflow/models/python_api.py
imports: import json
  import logging
  import os
  from datetime import datetime
  from io import StringIO
  from typing import ForwardRef, List, Optional, get_args, get_origin
  from mlflow.exceptions import MlflowException
  from mlflow.models.flavor_backend_registry import get_flavor_backend
  from mlflow.utils import env_manager
  from mlflow.utils.file_utils import TempDir
  from mlflow.utils.proto_json_utils import dump_input_data
label_desc: Use image node_id 5 for calling a global function with example usage: _serialize_to_json(input_data) and returns: json, input_data