---
title: json (DataStreamReader)
description: "DataStreamReader.json method in PySpark: Loads a JSON file stream and returns the results as a DataFrame. JSON Lines (newline-delimited JSON) is supported by default."
canonical_url: https://docs.databricks.com/gcp/en/pyspark/reference/classes/datastreamreader/json
---

# json (DataStreamReader)

Loads a JSON file stream and returns the results as a DataFrame. JSON Lines (newline-delimited JSON) is supported by default. For JSON with one record per file, set the `multiLine` option to `true`. If `schema` is not specified, the input schema is inferred from the data.

## Syntax

```
json(path, schema=None, **options)
```

## Parameters

| Parameter | Type                        | Description                                                                            |
| --------- | --------------------------- | -------------------------------------------------------------------------------------- |
| `path`    | str                         | Path to the JSON dataset.                                                              |
| `schema`  | StructType or str, optional | Schema as a StructType or DDL-formatted string (for example, `col0 INT, col1 DOUBLE`). |

## Returns

`DataFrame`

## Examples

Load a stream from a temporary JSON file:

```python
import tempfile
import time
with tempfile.TemporaryDirectory(prefix="json") as d:
    spark.createDataFrame(
        [(100, "Hyukjin Kwon"),], ["age", "name"]
    ).write.mode("overwrite").format("json").save(d)
    q = spark.readStream.schema(
        "age INT, name STRING"
    ).json(d).writeStream.format("console").start()
    time.sleep(3)
    q.stop()
```
