class_docstr: Reader object that loads experiences from JSON file chunks.
  
  The input files will be read from in random order.
docstr: Initializes a JsonReader instance.
  
  Args:
      inputs: Either a glob expression for files, e.g. `/tmp/**/*.json`,
          or a list of single file paths or URIs, e.g.,
          ["s3://bucket/file.json", "s3://bucket/file2.json"].
      ioctx: Current IO context object or None.
docstr_tok: ["Initializes","a","JsonReader","instance",".","Args",":","inputs",":","Either","a","glob","expression","for","files",",","e.g",".","`","\/tmp\/","*","*","\/","*",".json","`",",","or","a","list","of","single","file","paths","or","URIs",",","e.g.",",","[","``","s3",":","\/\/bucket\/file.json","''",",","``","s3",":","\/\/bucket\/file2.json","''","]",".","ioctx",":","Current","IO","context","object","or","None","."]
code: def __init__(
      self,
      inputs: Union[str, List[str]],
      ioctx: Optional[IOContext] = None,
  ):
      """Initializes a JsonReader instance.
  
      Args:
          inputs: Either a glob expression for files, e.g. `/tmp/**/*.json`,
              or a list of single file paths or URIs, e.g.,
              ["s3://bucket/file.json", "s3://bucket/file2.json"].
          ioctx: Current IO context object or None.
      """
      logger.info(
          "You are using JSONReader. It is recommended to use "
          + "DatasetReader instead for better sharding support."
      )
  
      self.ioctx = ioctx or IOContext()
      self.default_policy = self.policy_map = None
      self.batch_size = 1
      if self.ioctx:
          self.batch_size = self.ioctx.config.get("train_batch_size", 1)
          num_workers = self.ioctx.config.get("num_workers", 0)
          if num_workers:
              self.batch_size = max(
                  math.ceil(self.batch_size / num_workers), 1
              )
  
      if self.ioctx.worker is not None:
          self.policy_map = self.ioctx.worker.policy_map
          self.default_policy = self.policy_map.get(DEFAULT_POLICY_ID)
  
      if isinstance(inputs, str):
          inputs = os.path.abspath(os.path.expanduser(inputs))
          if os.path.isdir(inputs):
              inputs = [
                  os.path.join(inputs, "*.json"),
                  os.path.join(inputs, "*.zip"),
              ]
              logger.warning(
                  f"Treating input directory as glob patterns: {inputs}"
              )
          else:
              inputs = [inputs]
  
          if any(
              urlparse(i).scheme not in [""] + WINDOWS_DRIVES
              for i in inputs
          ):
              raise ValueError(
                  "Don't know how to glob over `{}`, ".format(inputs)
                  + "please specify a list of files to read instead."
              )
          else:
              self.files = []
              for i in inputs:
                  self.files.extend(glob.glob(i))
      elif isinstance(inputs, (list, tuple)):
          self.files = list(inputs)
      else:
          raise ValueError(
              "type of inputs must be list or str, not {}".format(
                  inputs
              )
          )
      if self.files:
          logger.info("Found {} input files.".format(len(self.files)))
      else:
          raise ValueError("No files found matching {}".format(inputs))
      self.cur_file = None
  
imports: import glob
  import json
  import logging
  import math
  import numpy
  import os
  from pathlib import Path
  import random
  import re
  import tree
  from typing import List, Optional, TYPE_CHECKING, Union
  from urllib.parse import urlparse
  import zipfile
  from ray.rllib.offline.input_reader import InputReader
  from ray.rllib.offline.io_context import IOContext
  from ray.rllib.policy.policy import Policy
  from ray.rllib.policy.sample_batch import DEFAULT_POLICY_ID, MultiAgentBatch, SampleBatch, concat_samples, convert_ma_batch_to_sample_batch
  from ray.rllib.utils.annotations import override, PublicAPI, DeveloperAPI
  from ray.rllib.utils.compression import unpack_if_needed
  from ray.rllib.utils.spaces.space_utils import clip_action, normalize_action
  from ray.rllib.utils.typing import Any, FileType, SampleBatchType
label_desc: Use image node_id 1 to create a new JsonReader object from inherited base classes: InputReader with example: obj = JsonReader(inputs, ioctx)