class_docstr: JsonReader provides an interface for reading in a JSON file.
  
  If initialized with ``lines=True`` and ``chunksize``, can be iterated over
  ``chunksize`` lines at a time. Otherwise, calling ``read`` reads in the
  whole document.
class_docstr_tok: ["JsonReader","provides","an","interface","for","reading","in","a","JSON","file",".","If","initialized","with","``","lines=True","``","and","``","chunksize","``",",","can","be","iterated","over","``","chunksize","``","lines","at","a","time",".","Otherwise",",","calling","``","read","``","reads","in","the","whole","document","."]
docstr: At this point, the data either has a `read` attribute (e.g. a file
  object or a StringIO) or is a string that is a JSON document.
  
  If self.chunksize, we prepare the data for the `__next__` method.
  Otherwise, we read it into memory for the `read` method.
docstr_tok: ["At","this","point",",","the","data","either","has","a","`","read","`","attribute","(","e.g",".","a","file","object","or","a","StringIO",")","or","is","a","string","that","is","a","JSON","document",".","If","self.chunksize",",","we","prepare","the","data","for","the","`","__next__","`","method",".","Otherwise",",","we","read","it","into","memory","for","the","`","read","`","method","."]
code: def _preprocess_data(self, data):
      """
      At this point, the data either has a `read` attribute (e.g. a file
      object or a StringIO) or is a string that is a JSON document.
  
      If self.chunksize, we prepare the data for the `__next__` method.
      Otherwise, we read it into memory for the `read` method.
      """
      if hasattr(data, "read") and not self.chunksize:
          data = data.read()
      if not hasattr(data, "read") and self.chunksize:
          data = StringIO(data)
  
      return data
  
imports: from itertools import islice
  import os
  import numpy
  import pandas._libs.json
  from pandas._libs.tslibs import iNaT
  from pandas.compat import StringIO, long, to_str, u
  from pandas.errors import AbstractMethodError
  from pandas.core.dtypes.common import is_period_dtype
  from pandas import DataFrame, MultiIndex, Series, compat, isna, to_datetime
  from pandas.core.reshape.concat import concat
  from pandas.io.common import BaseIterator, _get_handle, _infer_compression, _stringify_path, get_filepath_or_buffer
  from pandas.io.formats.printing import pprint_thing
  from pandas.io.parsers import _validate_integer
  from .normalize import _convert_to_line_delimits
  from .table_schema import build_table_schema, parse_table_schema
label_desc: Use image node_id 2 for calling the JsonReader obj's underlying member method code with example usage: obj._preprocess_data(data) and returns: data