class_docstr: Implementation. Captures batches in KServe v2 protocol format, returns
  also in FServing v2 protocol format.
class_docstr_tok: ["Implementation",".","Captures","batches","in","KServe","v2","protocol","format",",","returns","also","in","FServing","v2","protocol","format","."]
docstr: Extracts the data from the JSON object
docstr_tok: ["Extracts","the","data","from","the","JSON","object"]
code: def _from_json(self, body_list):
      """
      Extracts the data from the JSON object
      """
      if isinstance(body_list[0], (bytes, bytearray)):
          body_list = [
              json.loads(body.decode("utf8")) for body in body_list
          ]
          logger.debug("Bytes array is %s", body_list)
  
      input_names = []
      for index, input in enumerate(body_list[0]["inputs"]):
          if input["datatype"] == "BYTES":
              body_list[0]["inputs"][index]["data"] = input["data"][0]
          else:
              body_list[0]["inputs"][index]["data"] = (
                  np.array(input["data"])
                  .reshape(tuple(input["shape"]))
                  .tolist()
              )
          input_names.append(input["name"])
      setattr(self.context, "input_names", input_names)
      logger.debug("Bytes array is %s", body_list)
      id = body_list[0].get("id")
      if id and id.strip():
          setattr(self.context, "input_request_id", body_list[0]["id"])
      # TODO: Add parameters support
      # parameters = body_list[0].get("parameters")
      # if parameters:
      #     setattr(self.context, "input_parameters", body_list[0]["parameters"])
      data_list = [
          inputs_list.get("inputs") for inputs_list in body_list
      ][0]
      return data_list
  
file_path: serve/ts/torch_handler/request_envelope/kservev2.py
imports: import json
  import logging
  import numpy
  from .base import BaseEnvelope
label_desc: Use image node_id 3 for calling the KServev2Envelope obj's underlying member method code with example usage: obj._from_json(body_list) and returns: data_list