# APOC Export JSON Append to Existing File

**URL:** <https://community.neo4j.com/t/apoc-export-json-append-to-existing-file/43948>\
**Category:** Procedures & APOC\
**Tags:** apoc, json, apocperiodiciterate\
**Created:** [September 4, 2021, 8:44pm UTC](https://community.neo4j.com/t/apoc-export-json-append-to-existing-file/43948 "2021-09-04T20:44:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jona](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/jona/32/4907_2.png) [@jona](https://community.neo4j.com/u/jona)\
**Post date:** [September 4, 2021, 8:44pm UTC](https://community.neo4j.com/t/apoc-export-json-append-to-existing-file/43948/1 "2021-09-04T20:44:22Z")

</div>

Hello!

I am trying to use apoc.export.json.query() inside of a apoc.periodic.iterate() call.

In my Cypher query below, only the last result is saved to the "output.json" file as I presume the previous results are overwritten. Is there a way to append to the existing json file as we iterate?

```auto
CALL apoc.periodic.iterate(
   "MATCH (n:Person) RETURN n",
   "CALL apoc.export.json.query(
      \"RETURN $n.name AS name\",
      \"output.json\",
      {params:{n:n}}
   ) YIELD file RETURN file",
   {batchSize: 500}
)

```

Thanks!
