code: def json_to_data(json_string, custom_objects=None):
      """
      Turn JSON serialization of class-parameters back into dictionary.
  
      :param json_string: (str) JSON serialization of the class-parameters
          that should be loaded.
      :param custom_objects: (dict) Dictionary of objects to replace
          upon loading. If a variable is present in this dictionary as a
          key, it will not be deserialized and the corresponding item
          will be used instead. Similar to custom_objects in
          `keras.models.load_model`. Useful when you have an object in
          file that can not be deserialized.
      :return: (dict) Loaded class parameters.
      """
      if custom_objects is not None and not isinstance(
          custom_objects, dict
      ):
          raise ValueError(
              "custom_objects argument must be a dict or None"
          )
  
      json_dict = json.loads(json_string)
      # This will be filled with deserialized data
      return_data = {}
      for data_key, data_item in json_dict.items():
          if (
              custom_objects is not None
              and data_key in custom_objects.keys()
          ):
              # If item is provided in custom_objects, replace
              # the one from JSON with the one in custom_objects
              return_data[data_key] = custom_objects[data_key]
          elif (
              isinstance(data_item, dict)
              and ":serialized:" in data_item.keys()
          ):
              # If item is dictionary with ":serialized:"
              # key, this means it is serialized with cloudpickle.
              serialization = data_item[":serialized:"]
              # Try-except deserialization in case we run into
              # errors. If so, we can tell bit more information to
              # user.
              try:
                  deserialized_object = cloudpickle.loads(
                      base64.b64decode(serialization.encode())
                  )
              except pickle.UnpicklingError:
                  raise RuntimeError(
                      "Could not deserialize object {}. ".format(
                          data_key
                      )
                      + "Consider using `custom_objects` argument to replace "
                      + "this object."
                  )
              return_data[data_key] = deserialized_object
          else:
              # Read as it is
              return_data[data_key] = data_item
      return return_data
  
file_path: stable-baselines/stable_baselines/common/save_util.py
imports: import base64
  from collections import OrderedDict
  import io
  import json
  import pickle
  import cloudpickle
  import numpy
label_desc: Use image node_id 3 for calling a global function with example usage: json_to_data(json_string, custom_objects) and returns: return_data