JSON#

class onetl.file.format.json.JSON(*, multiLine: Literal[True] = True, encoding: str = 'utf-8', lineSep: str = '\n', **kwargs)#

JSON file format. support_hooks

Based on Spark JSON file format.

Supports reading (but NOT writing) files with .json extension with content like:

example.json#
[
    {"key": "value1"},
    {"key": "value2"}
]

Warning

For writing prefer using JSONLine.

Note

You can pass any option to the constructor, even if it is not mentioned in this documentation. Option names should be in camelCase!

The set of supported options depends on Spark version. See link above.

Examples

Describe options how to read from/write to JSON file with specific options:

json = JSON(encoding="utf-8", compression="gzip")
__init__(**kwargs)#