apoc.import.json
Procedure APOC Core
apoc.import.json(file,config) - imports the json list to the provided file
Signature
apoc.import.json(file :: STRING?, config = {} :: MAP?) :: (file :: STRING?, source :: STRING?, format :: STRING?, nodes :: INTEGER?, relationships :: INTEGER?, properties :: INTEGER?, time :: INTEGER?, rows :: INTEGER?, batchSize :: INTEGER?, batches :: INTEGER?, done :: BOOLEAN?, data :: STRING?)
Config parameters
This procedure supports the following config parameters:
name | type | default | description |
---|---|---|---|
unwindBatchSize |
Integer |
|
the batch size of the unwind |
txBatchSize |
Integer |
|
the batch size of the transacttion |
importIdName |
String |
|
the name of the "id" field into the used for the import it refers to the "id" field into the root object of the json. |
nodePropertyMappings |
Map |
|
The mapping label/property name/property type for Custom Neo4j types (point date). I.e. { User: { born: 'Point', dateOfBirth: 'Datetime' } } |
relPropertyMappings |
Map |
|
The mapping rel type/property name/property type for Custom Neo4j types (point date). I.e. { KNOWS: { since: 'Datetime' } } |
nodePropertyMappings
and relPropertyMappings
support the following Neo4j types:
-
Point
-
Localdate
-
Localtime
-
Localdatetime
-
Duration
-
offsettime
-
Zoneddatetime
Output parameters
Name | Type |
---|---|
file |
STRING? |
source |
STRING? |
format |
STRING? |
nodes |
INTEGER? |
relationships |
INTEGER? |
properties |
INTEGER? |
time |
INTEGER? |
rows |
INTEGER? |
batchSize |
INTEGER? |
batches |
INTEGER? |
done |
BOOLEAN? |
data |
STRING? |
Usage Examples
The apoc.import.json
procedure can be used to import JSON files created by the apoc.export.json.*
procedures.
all.json
contains a subset of Neo4j’s movies graph, and was generated by apoc.export.json.all.
{"type":"node","id":"0","labels":["User"],"properties":{"born":"2015-07-04T19:32:24","name":"Adam","place":{"crs":"wgs-84","latitude":33.46789,"longitude":13.1,"height":null},"age":42,"male":true,"kids":["Sam","Anna","Grace"]}}
{"type":"node","id":"1","labels":["User"],"properties":{"name":"Jim","age":42}}
{"type":"node","id":"2","labels":["User"],"properties":{"age":12}}
{"id":"0","type":"relationship","label":"KNOWS","properties":{"since":1993,"bffSince":"P5M1DT12H"},"start":{"id":"0","labels":["User"]},"end":{"id":"1","labels":["User"]}}
We can import this file using apoc.import.json
.
CALL apoc.import.json("file:///all.json")
file | source | format | nodes | relationships | properties | time | rows | batchSize | batches | done | data |
---|---|---|---|---|---|---|---|---|---|---|---|
"file:///all.json" |
"file" |
"json" |
3 |
1 |
15 |
105 |
4 |
-1 |
0 |
TRUE |
NULL |
Was this page helpful?