Mr_yassh
Mr_yassh

Reputation: 19

How to Import Json file to Neo4j

I have a Very big Json file and I would like to import it to Neo4j but When I used Apoc I get this error

Failed to invoke procedure `apoc.import.json`: Caused by: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type `java.util.LinkedHashMap<java.lang.Object,java.lang.Object>` from Array value (token `JsonToken.START_ARRAY`)
 at [Source: (String)"[[{ "; line: 1, column: 1]

The code I am using to import the file is:

CALL apoc.import.json("file:///eight9.json")

The Start of the file looks like this:

[[{ 
    "id" : "149715690143449899009",
    "objectType" : "activity",
    "actor" : {

But when I checked online it is a valid Json File.

Upvotes: 0

Views: 1753

Answers (1)

jose_bacoy
jose_bacoy

Reputation: 12704

It is complaining about "[[{ ". Below is taken from neo4j documentation; https://neo4j.com/labs/apoc/4.3/import/load-json/. A json format file starts with { so your json is NOT accepted by neo4j;

For example:
{
 "name":"Michael",
 "age": 41,
 "children": ["Selina","Rana","Selma"]
}

Please remove [[ at the start and ]] at the end of your file then try it again.

Upvotes: 1

Related Questions