# Apoc.export.json.query jsonFormat setting doesn't work

**URL:** <https://community.neo4j.com/t/apoc-export-json-query-jsonformat-setting-doesnt-work/35508>\
**Category:** General\
**Tags:** apoc\
**Created:** [March 18, 2021, 7:56pm UTC](https://community.neo4j.com/t/apoc-export-json-query-jsonformat-setting-doesnt-work/35508 "2021-03-18T19:56:46Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![tard\_gabriel](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/tard_gabriel/32/28033_2.png) [@tard\_gabriel](https://community.neo4j.com/u/tard_gabriel)\
**Post date:** [March 18, 2021, 7:56pm UTC](https://community.neo4j.com/t/apoc-export-json-query-jsonformat-setting-doesnt-work/35508/1 "2021-03-18T19:56:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dana\_canzano](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/dana_canzano/32/27392_2.png) [@dana\_canzano](https://community.neo4j.com/u/dana_canzano)\
**Post date:** [March 18, 2021, 8:47pm UTC](https://community.neo4j.com/t/apoc-export-json-query-jsonformat-setting-doesnt-work/35508/2 "2021-03-18T20:47:32Z")

</div>

@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

```auto
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

---

<div class="post-metadata">

**Author:** ![tard\_gabriel](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/tard_gabriel/32/28033_2.png) [@tard\_gabriel](https://community.neo4j.com/u/tard_gabriel)\
**Post date:** [March 18, 2021, 8:48pm UTC](https://community.neo4j.com/t/apoc-export-json-query-jsonformat-setting-doesnt-work/35508/3 "2021-03-18T20:48:13Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dana\_canzano](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/dana_canzano/32/27392_2.png) [@dana\_canzano](https://community.neo4j.com/u/dana_canzano)\
**Post date:** [March 18, 2021, 8:49pm UTC](https://community.neo4j.com/t/apoc-export-json-query-jsonformat-setting-doesnt-work/35508/4 "2021-03-18T20:49:31Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![tard\_gabriel](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/tard_gabriel/32/28033_2.png) [@tard\_gabriel](https://community.neo4j.com/u/tard_gabriel)\
**Post date:** [March 18, 2021, 8:54pm UTC](https://community.neo4j.com/t/apoc-export-json-query-jsonformat-setting-doesnt-work/35508/5 "2021-03-18T20:54:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![amirkanan](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/amirkanan/32/17452_2.png) [@amirkanan](https://community.neo4j.com/u/amirkanan)\
**Post date:** [March 26, 2021, 8:57am UTC](https://community.neo4j.com/t/apoc-export-json-query-jsonformat-setting-doesnt-work/35508/6 "2021-03-26T08:57:57Z")

</div>

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

JsonFormat setting doesn't work!

> [@Neo4j export whole database to ARRAY\_JSON](https://community.neo4j.com/t/neo4j-export-whole-database-to-array-json/35902):
>
> I tried to use an APOC procedure from [here](https://neo4j.com/labs/apoc/4.1/overview/apoc.export/apoc.export.json.all/) to export the DB using the following: CALL apoc.export.json.all("all.json",{useTypes:true}) I can successfuly export to JSONL. However, I am not able to change the JSON format to other available formats such as JSON\_LINES, ARRAY\_JSON, JSON or JSON\_ID\_AS\_KEYS. According to the documentation the following should work but it does not: CALL apoc.export.json.all("all.json",{config:{jsonFormat:'ARRAY\_JSON'}}) The result of above procedure is in JSONL but …

---

<div class="post-metadata">

**Author:** ![jbacoy3](https://avatars.discourse-cdn.com/v4/letter/j/ecae2f/32.png) [@jbacoy3](https://community.neo4j.com/u/jbacoy3)\
**Post date:** [March 26, 2021, 5:00pm UTC](https://community.neo4j.com/t/apoc-export-json-query-jsonformat-setting-doesnt-work/35508/7 "2021-03-26T17:00:14Z")

</div>

> <https://stackoverflow.com/questions/66810830/neo4j-export-whole-database-to-json-lines-array-json-json-or-json-id-as-keys/66821226#66821226>

This is now fixed in APOC 4.2.0.2. Thanks.

---

<div class="post-metadata">

**Author:** ![tard\_gabriel](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/tard_gabriel/32/28033_2.png) [@tard\_gabriel](https://community.neo4j.com/u/tard_gabriel)\
**Post date:** [March 26, 2021, 7:13pm UTC](https://community.neo4j.com/t/apoc-export-json-query-jsonformat-setting-doesnt-work/35508/8 "2021-03-26T19:13:16Z")

</div>

Yeah! I wasn't crazy! lol

Thanks
