Typed JSON
Plain vs Typed JSON
The Plain JSON result format does not provide information about the type of a returned value.
For example, the two following requests result in the exact same response, even if in the first case the return value is a Cypher STRING, while in the second case it is a ZONED DATETIME.
{
"statement": "RETURN '2024-01-01T21:40:32-01:00'"
}
{
"statement": "RETURN datetime('2024-01-01T21:40:32-01:00')"
}
If you care about what type each returned value is, you can use Neo4j’s extended JSON format with type information.
Enable Typed JSON
To receive the result in Typed JSON format, set Accept: application/vnd.neo4j.query.v1.1 in the request headers.
In this format, each return value is an object where the type and value information are stored as separate keys:
OffsetDateTime value with the JSON with type information{
"$type":"OffsetDateTime",
"_value":"2024-01-01T21:40:32-01:00"
}
If you wish to also submit parameters with this format, set Content-Type: application/vnd.neo4j.query.v1.1 in the request headers.
Examples
Example request
POST http://localhost:7474/db/neo4j/query/v2
Authorization: Basic bmVvNGo6dmVyeXNlY3JldA==
Accept: application/vnd.neo4j.query.v1.1
Content-Type: application/vnd.neo4j.query.v1.1
{
"statement": "MERGE (p:Person {name: $name}) RETURN p AS person, p.name AS name",
"parameters": {
"name": {
"$type": "String",
"_value": "Phil"
}
}
}
Example response
202: Accepted
Content-Type: application/vnd.neo4j.query.v1.1
{
"data": {
"fields": [
"person",
"name"
],
"values": [
[
{
"$type": "Node",
"_value": {
"_element_id": "4:ff04df25-ff2b-4b55-98f8-6888297b025e:2",
"_labels": [
"Person"
],
"_properties": {
"name": {
"$type": "String",
"_value": "Phil"
}
}
}
},
{
"$type": "String",
"_value": "Phil"
}
]
]
},
"bookmarks": [
"FB:kcwQ/wTfJf8rS1WY+GiIKXsCXg6Q"
]
}
Type mapping
This section details how Cypher types are labeled in the Query API.
| Cypher type | Query API type | Example | ||
|---|---|---|---|---|
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
Enterprise Edition Introduced in 2025.11
|
||
|
|
Introduced in 2025.11 |