class_docstr: Creates `Dataset` objects from input json files.
  
  This class provides conveniences to load data from json files.
  It's possible to directly featurize data from json files using
  pandas, but this class may prove useful if you're processing
  large json files that you don't want to manipulate directly in
  memory.
  
  It is meant to load JSON files formatted as "records" in line
  delimited format, which allows for sharding.
  ``list like [{column -> value}, ... , {column -> value}]``.
  
  Examples
  --------
  Let's create the sample dataframe.
  
  >>> composition = ["LiCoO2", "MnO2"]
  >>> labels = [1.5, 2.3]
  >>> import pandas as pd
  >>> df = pd.DataFrame(list(zip(composition, labels)), columns=["composition", "task"])
  
  Dump the dataframe to the JSON file formatted as "records" in line delimited format and
  load the json file by JsonLoader.
  
  >>> import tempfile
  >>> import deepchem as dc
  >>> with dc.utils.UniversalNamedTemporaryFile(mode='w') as tmpfile:
  ...     df.to_json(tmpfile.name, orient='records', lines=True)
  ...     featurizer = dc.feat.ElementPropertyFingerprint()
  ...     loader = dc.data.JsonLoader(["task"], feature_field="composition", featurizer=featurizer)
  ...     dataset = loader.create_dataset(tmpfile.name)
  >>> len(dataset)
  2
class_docstr_tok: ["Creates","`","Dataset","`","objects","from","input","json","files",".","This","class","provides","conveniences","to","load","data","from","json","files",".","It","'s","possible","to","directly","featurize","data","from","json","files","using","pandas",",","but","this","class","may","prove","useful","if","you","'re","processing","large","json","files","that","you","do","n't","want","to","manipulate","directly","in","memory",".","It","is","meant","to","load","JSON","files","formatted","as","``","records","''","in","line","delimited","format",",","which","allows","for","sharding",".","``","list","like","[","{","column","-",">","value","}",",","...",",","{","column","-",">","value","}","]","``",".","Examples","--","--","--","--","Let","'s","create","the","sample","dataframe",".",">",">",">","composition","=","[","``","LiCoO2","''",",","``","MnO2","''","]",">",">",">","labels","=","[","1.5",",","2.3","]",">",">",">","import","pandas","as","pd",">",">",">","df","=","pd.DataFrame","(","list","(","zip","(","composition",",","labels",")",")",",","columns=","[","``","composition","''",",","``","task","''","]",")","Dump","the","dataframe","to","the","JSON","file","formatted","as","``","records","''","in","line","delimited","format","and","load","the","json","file","by","JsonLoader",".",">",">",">","import","tempfile",">",">",">","import","deepchem","as","dc",">",">",">","with","dc.utils.UniversalNamedTemporaryFile","(","mode=","'","w","'",")","as","tmpfile",":","...","df.to_json","(","tmpfile.name",",","orient='records","'",",","lines=True",")","...","featurizer","=","dc.feat.ElementPropertyFingerprint","(",")","...","loader","=","dc.data.JsonLoader","(","[","``","task","''","]",",","feature_field=","''","composition","''",",","featurizer=featurizer",")","...","dataset","=","loader.create_dataset","(","tmpfile.name",")",">",">",">","len","(","dataset",")","2"]
docstr: Initializes JsonLoader.
  
  Parameters
  ----------
  tasks: List[str]
      List of task names
  feature_field: str
      JSON field with data to be featurized.
  featurizer: Featurizer
      Featurizer to use to process data
  label_field: str, optional (default None)
      Field with target variables.
  weight_field: str, optional (default None)
      Field with weights.
  id_field: str, optional (default None)
      Field for identifying samples.
  log_every_n: int, optional (default 1000)
      Writes a logging statement this often.
docstr_tok: ["Initializes","JsonLoader",".","Parameters","--","--","--","--","--","tasks",":","List","[","str","]","List","of","task","names","feature_field",":","str","JSON","field","with","data","to","be","featurized",".","featurizer",":","Featurizer","Featurizer","to","use","to","process","data","label_field",":","str",",","optional","(","default","None",")","Field","with","target","variables",".","weight_field",":","str",",","optional","(","default","None",")","Field","with","weights",".","id_field",":","str",",","optional","(","default","None",")","Field","for","identifying","samples",".","log_every_n",":","int",",","optional","(","default","1000",")","Writes","a","logging","statement","this","often","."]
code: def __init__(
      self,
      tasks: List[str],
      feature_field: str,
      featurizer: Featurizer,
      label_field: Optional[str] = None,
      weight_field: Optional[str] = None,
      id_field: Optional[str] = None,
      log_every_n: int = 1000,
  ):
      """Initializes JsonLoader.
  
      Parameters
      ----------
      tasks: List[str]
          List of task names
      feature_field: str
          JSON field with data to be featurized.
      featurizer: Featurizer
          Featurizer to use to process data
      label_field: str, optional (default None)
          Field with target variables.
      weight_field: str, optional (default None)
          Field with weights.
      id_field: str, optional (default None)
          Field for identifying samples.
      log_every_n: int, optional (default 1000)
          Writes a logging statement this often.
      """
      if not isinstance(tasks, list):
          raise ValueError("Tasks must be a list.")
      self.tasks = tasks
      self.feature_field = feature_field
      self.label_field = label_field
      self.weight_field = weight_field
      self.id_field = id_field
  
      self.user_specified_features = None
      if isinstance(featurizer, UserDefinedFeaturizer):
          self.user_specified_features = featurizer.feature_fields
      self.featurizer = featurizer
      self.log_every_n = log_every_n
  
imports: import os
  import tempfile
  import zipfile
  import time
  import logging
  import warnings
  from typing import List, Optional, Tuple, Any, Sequence, Union, Iterator
  import pandas
  import numpy
  from deepchem.utils.typing import OneOrMany
  from deepchem.utils.data_utils import load_image_files, load_csv_files, load_json_files, load_sdf_files, unzip_file
  from deepchem.feat import UserDefinedFeaturizer, Featurizer
  from deepchem.data import Dataset, DiskDataset, NumpyDataset, ImageDataset
  from deepchem.feat.molecule_featurizers import OneHotFeaturizer
  from deepchem.utils.genomics_utils import encode_bio_sequence
label_desc: Use image node_id 1 to create a new JsonLoader object from inherited base classes: DataLoader with example: obj = JsonLoader(tasks, feature_field, featurizer, label_field, weight_field, id_field, log_every_n)