cancel
Showing results for 
Search instead for 
Did you mean: 

Join the community at Nodes 2022, our free virtual event on November 16 - 17.

tard_gabriel
Ninja
Ninja

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.

Comments
dana_canzano
Neo4j
Neo4j

@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

tard_gabriel
Ninja
Ninja

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.

dana_canzano
Neo4j
Neo4j

@tard.gabriel
'it doesnt fit with the documentation' ???? can you provide reference so we can address?

tard_gabriel
Ninja
Ninja

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

amirkanan
Node Link

I am experiencing the same issue for Apoc.export.json.all.

JsonFormat setting doesn't work!

jbacoy3
Node
tard_gabriel
Ninja
Ninja

Yeah! I wasn't crazy! lol

Thanks

Version history
Last update:
‎03-18-2021 12:56 PM
Updated by:
Contributors