Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
on 03-18-2021 12:56 PM
Hello there
I'm using this query to format my data for Keylines.
CALL apoc.export.json.query("MATCH (actor: Actor {name: $nameParam})-[acted:ACTED_IN]->(movie:Movie) MATCH (movie)<--(a:Actor) RETURN movie, actor,count(distinct a) AS degree",null,{config:{jsonFormat:'JSON'}, params:{nameParam:'Johnny Depp'}, stream: true})
I'm trying to use the ARRAY_JSON value for the jsonFormat configuration but whether I use any of them [ARRAY_JSON, JSON, JSON_LINES,JSON_ID_AS_KEYS] the result in the data column doesn't change.
It's like the jsonFormat does nothing, even if the query itself works.
@tard.gabriel
With Neo4j 4.2.1 and APOC apoc-4.2.0.0-core.jar
and
using the dataset from ':play movies' and if I modify your original query to
CALL apoc.export.json.query("MATCH (actor:Person {name: $nameParam})-[acted:ACTED_IN]->(movie:Movie) RETURN movie, actor",null,{config:{jsonFormat:'JSON'}, params:{nameParam:'Tom Hanks'}, stream: true});
I do get expected JSON results and when run via bin/cyphe-shell.
So the apoc.export.json query does work but seems like maybe there is issue with your query
I fixed it using this syntax:
CALL apoc.export.json.query("MATCH (actor: Actor {name: $name})-[acted:ACTED_IN]->(movie:Movie) MATCH (movie)<--(a:Actor) RETURN movie, actor,count(distinct a) AS degree",null,{jsonFormat:'ARRAY_JSON', params:{name:'Johnny Depp'}, stream: true})
But I feel it doesn't fit with the documentation.
@tard.gabriel
'it doesnt fit with the documentation' ???? can you provide reference so we can address?
With Neo4j 4.2.3
When I use jsonFormat as a part of the config: {} parameter like you did it doesn't work. Whether I use any of them [ARRAY_JSON, JSON, JSON_LINES,JSON_ID_AS_KEYS] the result in the data column doesn't change. I had to put the jsonFormat like this in the query:
CALL apoc.export.json.query("MATCH (actor: Actor {name: $name})-[acted:ACTED_IN]->(movie:Movie) MATCH (movie)<--(a:Actor) RETURN movie, actor,count(distinct a) AS degree",null,{jsonFormat:'ARRAY_JSON', params:{name:'Johnny Depp'}, stream: true})
But the documentation say that jsonFormat should be a part of config parameter.
I did the test again and indeed with this form "config:{jsonFormat:'ARRAY_JSON'}" the jsonFormat is ignored with Neo4j 4.2.3 and apoc-4.2.0.1.jar
I am experiencing the same issue for Apoc.export.json.all.
JsonFormat setting doesn't work!
This is now fixed in APOC 4.2.0.2. Thanks.
Yeah! I wasn't crazy! lol
Thanks