I would like to reproduce the Neo4j Browser JSON format which is something like this :
[
{
"p": {
"start": {
"identity": 2,
"labels": [
"Person"
],
"properties": {
"born": 1964,
"name": "Keanu Reeves"
}
},
"end": {
"identity": 155,
"labels": [
"Movie"
],
"properties": {
"title": "Something's Gotta Give",
"released": 2003
}
},
"segments": [
{
"start": {
"identity": 2,
"labels": [
"Person"
],
"properties": {
"born": 1964,
"name": "Keanu Reeves"
}
},
"relationship": {
"identity": 221,
"start": 2,
"end": 155,
"type": "ACTED_IN",
"properties": {
"roles": [
"Julian Mercer"
]
}
},
"end": {
"identity": 155,
"labels": [
"Movie"
],
"properties": {
"title": "Something's Gotta Give",
"released": 2003
}
}
}
],
"length": 1
}
},
{
"p": {
"start": {
"identity": 2,
"labels": [
"Person"
],
"properties": {
"born": 1964,
"name": "Keanu Reeves"
}
},
"end": {
"identity": 88,
"labels": [
"Movie"
],
"properties": {
"tagline": "Pain heals, Chicks dig scars... Glory lasts forever",
"title": "The Replacements",
"released": 2000
}
},
"segments": [
{
"start": {
"identity": 2,
"labels": [
"Person"
],
"properties": {
"born": 1964,
"name": "Keanu Reeves"
}
},
"relationship": {
"identity": 114,
"start": 2,
"end": 88,
"type": "ACTED_IN",
"properties": {
"roles": [
"Shane Falco"
]
}
},
"end": {
"identity": 88,
"labels": [
"Movie"
],
"properties": {
"tagline": "Pain heals, Chicks dig scars... Glory lasts forever",
"title": "The Replacements",
"released": 2000
}
}
}
],
"length": 1
}
}
]
I've tried to do it with an httpie command to in order to retrieve what is sent to the transactional cypher endpoint but I got something with data, rows and metadata.
My goal is to retrieve a part of my database with a Cypher request, and to retrieve via Python, the JSON like the one of the Neo4j Browser button.
Thanks for your help !
You can retrieve via Python, and keep it as dict type, then you can use json to save this dict with parameter "indent".
json.dump