code: def _obj_from_json(d: dict[str, Any]):
      """JSON deserialization helper.
  
      Args:
        d: The JSON Object-like dictionary to attempt to parse.
  
      Returns:
        The parsed JSON as a Python object or class instance.
  
      Raises:
        LitJsonParseError: If `LitType.from_json()` cannot parse the JSON.
      """
      obj_class = d.pop("__class__", None)
      if obj_class == "np.ndarray":
          return np.array(d["__value__"])
      elif obj_class == "DataTuple":
          return dtypes.DataTuple.from_json(d)
      elif obj_class == "tuple":
          return tuple(d["__value__"])
      else:
          try:
              # The __class__ property was removed from JSON serialized LitTypes in
              # cl/464631365, therefore if obj_class is None try to parse to a LitType
              # TODO(b/260830384): Maybe bringing back __class__ is safer here?
              return types.LitType.from_json(d)
          except KeyError:
              # LitType.from_json() failing because of a KeyError means that the JSON
              # did no have a __name__ property, so it is probably not a LitType.
              # Return it as-is.
              return d
          except (NameError, TypeError) as e:
              # If parsing failed for reasons other than a KeyError, then the JSON has
              # a __name__ property, implying was intended to be a LitType but is
              # erroneously formatted, so we raise a RuntimeError
              raise LitJsonParseError(
                  f"Failed to parse LitType from {d}"
              ) from e
  
file_path: lit/lit_nlp/lib/serialize.py
imports: import json
  from types import MappingProxyType
  from typing import Any, cast, Optional
  from lit_nlp.api import dtypes
  from lit_nlp.api import types
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: _obj_from_json(d) and returns: np, dtypes, tuple, types, d