class_docstr: This is a lightweight stateless class that bundles together instantiation utils.
  It is used both on its own and as a mixin to AxClient, with the intent that
  these methods can be overridden by its subclasses for specific use cases.
class_docstr_tok: ["This","is","a","lightweight","stateless","class","that","bundles","together","instantiation","utils",".","It","is","used","both","on","its","own","and","as","a","mixin","to","AxClient",",","with","the","intent","that","these","methods","can","be","overridden","by","its","subclasses","for","specific","use","cases","."]
docstr: Instantiate a parameter from JSON representation.
docstr_tok: ["Instantiate","a","parameter","from","JSON","representation","."]
code: def parameter_from_json(
      cls,
      representation: TParameterRepresentation,
  ) -> Parameter:
      """Instantiate a parameter from JSON representation."""
      if "parameter_type" in representation:
          raise ValueError(
              "'parameter_type' is not an expected key in parameter dictionary. "
              "If you are looking to specify the type of values that this "
              "parameter should take, use 'value_type' (expects 'int', 'float', "
              "'str' or 'bool')."
          )
      unexpected_keys = (
          set(representation.keys()) - EXPECTED_KEYS_IN_PARAM_REPR
      )
      if unexpected_keys:
          raise ValueError(
              f"Unexpected keys {unexpected_keys} in parameter representation."
              f"Exhaustive set of expected keys: {EXPECTED_KEYS_IN_PARAM_REPR}."
          )
      name = representation["name"]
      assert isinstance(name, str), "Parameter name must be a string."
      parameter_class = representation["type"]
      assert (
          isinstance(parameter_class, str)
          and parameter_class in PARAM_CLASSES
      ), (
          "Type in parameter JSON representation must be "
          "`range`, `choice`, or `fixed`."
      )
  
      parameter_type = representation.get("value_type", None)
      if parameter_type is not None:
          assert (
              isinstance(parameter_type, str)
              and parameter_type in PARAM_TYPES
          ), (
              "Value type in parameter JSON representation must be 'int', 'float', "
              "'bool' or 'str'."
          )
  
      if parameter_class == "range":
          return cls._make_range_param(
              name=name,
              representation=representation,
              parameter_type=parameter_type,
          )
  
      if parameter_class == "choice":
          assert (
              "values" in representation
          ), "Values are required for choice parameters."
          values = representation["values"]
          if isinstance(values, list) and len(values) == 1:
              logger.info(
                  f"Choice parameter {name} contains only one value, converting to a"
                  + " fixed parameter instead."
              )
              # update the representation to a fixed parameter class
              parameter_class = "fixed"
              representation["type"] = parameter_class
              representation["value"] = values[0]
              del representation["values"]
          else:
              return cls._make_choice_param(
                  name=name,
                  representation=representation,
                  parameter_type=parameter_type,
              )
  
      if parameter_class == "fixed":
          assert not any(
              isinstance(val, list) for val in representation.values()
          )
          return cls._make_fixed_param(
              name=name,
              representation=representation,
              parameter_type=parameter_type,
          )
      else:
          raise ValueError(
              f"Unrecognized parameter type {parameter_class}."
          )
  
imports: import enum
  from dataclasses import dataclass
  from logging import Logger
  from typing import Any, Dict, List, Optional, Sequence, Type, Union
  from ax.core.arm import Arm
  from ax.core.experiment import DataType, DEFAULT_OBJECTIVE_NAME, Experiment
  from ax.core.map_metric import MapMetric
  from ax.core.metric import Metric
  from ax.core.objective import MultiObjective, Objective
  from ax.core.observation import ObservationFeatures
  from ax.core.optimization_config import MultiObjectiveOptimizationConfig, ObjectiveThreshold, OptimizationConfig
  from ax.core.outcome_constraint import OutcomeConstraint
  from ax.core.parameter import ChoiceParameter, FixedParameter, Parameter, PARAMETER_PYTHON_TYPE_MAP, ParameterType, RangeParameter, TParameterType
  from ax.core.parameter_constraint import OrderConstraint, ParameterConstraint
  from ax.core.search_space import HierarchicalSearchSpace, SearchSpace
  from ax.core.types import ComparisonOp, TParameterization, TParamValue
  from ax.exceptions.core import UnsupportedError
  from ax.utils.common.constants import Keys
  from ax.utils.common.logger import get_logger
  from ax.utils.common.typeutils import checked_cast, checked_cast_optional, checked_cast_to_tuple, not_none
label_desc: Use image node_id 8 for calling the InstantiationBase obj's underlying member method code with example usage: obj.parameter_from_json(cls, representation) and returns: cls, cls, cls