code: def objective_from_json(
      cls: Type[Objective], json_obj: Dict[str, Any]
  ) -> Objective:
      # backward compatibility
      metrics = json_obj.get("metrics")
      if metrics and not isinstance(metrics[0], Tuple):
          return any_from_json(MetricsObjective, json_obj)
      return any_from_json(cls, json_obj)
  
imports: from typing import Any, Dict, Type, Tuple
  from golem.core.optimisers.objective import Objective
  from golem.serializers.serializer import Serializer
  from golem.serializers.any_serialization import any_from_json
  from fedot.core.optimisers.objective.metrics_objective import MetricsObjective
label_desc: Use image node_id 1 for calling a global function with example usage: objective_from_json(cls, json_obj) and returns: any_from_json, any_from_json