Skip to content

ReadJson

Base classes

Name Children Inherits
ReadOp
datacook.engine.ops.sources
A reader: a source op with file extensions (the format registry looks them up).

⋔ Inheritance diagram

graph TD
  1372149503["sources.ReadJson"]
  1625742177["sources.ReadOp"]
  3484306131["base.CallOp"]
  1539482213["base.Op"]
  2751680898["builtins.object"]
  1625742177 --> 1372149503
  3484306131 --> 1625742177
  1539482213 --> 3484306131
  2751680898 --> 1539482213

🛈 DocStrings

Bases: ReadOp

Source code in src/datacook/engine/ops/sources.py
class ReadJson(ReadOp):
    id = "read_json"
    format_id = "json"
    title = _("JSON file")
    description = _("Read a JSON file (records, columns, ... or JSON lines).")
    function = "pd.read_json"
    extensions = (".json", ".jsonl", ".ndjson")

    class Params(base.Params):
        path: str = Field(title=N_("File"), json_schema_extra={"widget": "file"})
        orient: Literal["split", "records", "index", "columns", "values", "table"] | None = Field(
            None, title=N_("Layout")
        )
        lines: bool = Field(False, title=N_("JSON lines"))
        dtype_backend: DtypeBackend = Field("pyarrow", title=N_("Data types"))

:fa-brands-github: Show source on GitHub