code: def serialize_to_json_val(obj: Any) -> JSONVal:
      if isinstance(obj, (str, int, float, bool, type(None))):
          return obj
      elif isinstance(obj, list):
          return [serialize_to_json_val(item) for item in obj]
      elif isinstance(obj, dict):
          return {
              key: serialize_to_json_val(value)
              for key, value in obj.items()
          }
      else:
          raise TypeError(f"Unsupported type for to_json: {type(obj)}")
  
imports: import json
  from typing import Any, Dict, List, Union
label_desc: Use image node_id 3 for calling a global function with example usage: serialize_to_json_val(obj) and returns: obj, unknown, unknown