---
title: toString
url: https://nexyron.tech/docs/cypher/functions/type/tostring
description: Converts scalar values to strings while preserving null as null. It is documented separately because explicit type boundaries prevent planner tools from inventing hidden coercions
---

# toString

## Generic Description

Converts scalar values to strings while preserving null as null. It is documented separately because explicit type boundaries prevent planner tools from inventing hidden coercions for document-style values.

Simple example:

```cypher
RETURN toString(42) AS value
```

## Consumer-Level Explanation

Use it for explicit display or export shaping when mixed values must become readable text. Prefer this function when the input shape is mixed or imported and the query must state the intended type before comparison or aggregation.

## More Detailed Explanation

`toString` makes value shape explicit in Cypher. It is most useful around ingestion, document payloads, and assistant-generated queries where the planner should see the intended type boundary rather than relying on hidden client conversion.

## Advanced Example

This example applies `toString` at the point where a semi-structured value enters typed query logic, making the conversion boundary explicit.

```cypher
MATCH (d:Document)
RETURN d.title AS title, toString(properties(d).prize) AS priority_text
ORDER BY title
```

## Real Use Cases

-   normalizing imported CSV or document fields before comparison
-   guarding mixed payloads before list, map, or numeric operations
-   making assistant-authored query contracts explicit and reviewable

## Real Limitations And Tradeoffs

-   conversion only works when the input can be interpreted unambiguously
-   heavy conversion inside analytical queries can hide ingestion contract problems
-   type checks describe runtime values, not full schema validation
