> ## Documentation Index
> Fetch the complete documentation index at: https://docs.firebolt.io/llms.txt
> Use this file to discover all available pages before exploring further.

# JSON, variant, CSV, and XML functions

> Spark jSON, variant, CSV, and XML functions supported in SparkSQL and Databricks compatibility modes.

Preview

Spark [JSON](https://spark.apache.org/docs/latest/sql-ref-functions-builtin.html#json-functions), [variant](https://spark.apache.org/docs/latest/sql-ref-functions-builtin.html#variant-functions), [CSV](https://spark.apache.org/docs/latest/sql-ref-functions-builtin.html#csv-functions), and [XML](https://spark.apache.org/docs/latest/sql-ref-functions-builtin.html#xml-functions) functions in [SparkSQL and Databricks compatibility modes](https://docs.firebolt.io/reference-sql/spark/overview.md). Both modes share these functions. Support is one of: Supported, With limitations, or Not supported. Supported means every example in the Spark reference returns what Spark returns; a note under With limitations quotes a call that differs.

## JSON functions

| Function | Support | Notes |
| :- | :- | :- |
| [`JSON_OBJECT_KEYS`](https://spark.apache.org/docs/4.1.0/api/sql/#json_object_keys) | Supported | |
| [`JSON_ARRAY_LENGTH`](https://spark.apache.org/docs/4.1.0/api/sql/#json_array_length) | With limitations | `json_array_length('[1,2')` raises an error, where Spark returns `NULL`. |
| [`TO_JSON`](https://spark.apache.org/docs/4.1.0/api/sql/#to_json) | With limitations | Returns `JSON`, where Spark returns `TEXT`. `MAP` arguments are not supported. |
| `FROM_JSON`, `GET_JSON_OBJECT`, `JSON_TUPLE`, `SCHEMA_OF_JSON` | Not supported | |

## Variant functions

| Function | Support | Notes |
| :- | :- | :- |
| `IS_VARIANT_NULL`, `PARSE_JSON`, `SCHEMA_OF_VARIANT`, `SCHEMA_OF_VARIANT_AGG`, `TO_VARIANT_OBJECT`, `TRY_PARSE_JSON`, `TRY_VARIANT_GET`, `VARIANT_EXPLODE`, `VARIANT_EXPLODE_OUTER`, `VARIANT_GET` | Not supported | |

## CSV functions

| Function | Support | Notes |
| :- | :- | :- |
| `FROM_CSV`, `SCHEMA_OF_CSV`, `TO_CSV` | Not supported | |

## XML functions

| Function | Support | Notes |
| :- | :- | :- |
| `FROM_XML`, `SCHEMA_OF_XML`, `TO_XML`, `XPATH`, `XPATH_BOOLEAN`, `XPATH_DOUBLE`, `XPATH_FLOAT`, `XPATH_INT`, `XPATH_LONG`, `XPATH_NUMBER`, `XPATH_SHORT`, `XPATH_STRING` | Not supported | |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.