---
title: toJson
description: "VariantVal.toJson method in PySpark: Convert the VariantVal to a JSON string. The zone ID represents the time zone that the timestamp should be printed in. It is defaulted to UTC."
canonical_url: https://docs.databricks.com/aws/en/pyspark/reference/classes/variantval/toJson
---

# toJson

Convert the VariantVal to a JSON string. The zone ID represents the time zone that the timestamp should be printed in. It is defaulted to UTC. The list of valid zone IDs can be found by importing the `zoneinfo` module and running `zoneinfo.available_timezones()`.

*Added in Databricks Runtime 15.2*

## Syntax

```python
toJson(zone_id: str = "UTC")
```

## Returns

str - A JSON string that represents the Variant.
