apoc.import.json NullPointerException in Neo4J

Viewed 207

I am trying to import this JSON file and automatically create nodes out of it but I am getting the following error,

Failed to invoke procedure `apoc.import.json`: Caused by: java.lang.NullPointerException

My command,
CALL apoc.import.json('https://drive.google.com/uc?id=1MVMAZbrl_nIGruoUsLOkcrw1jcgRli-U')

When locally saved inside import,
CALL apoc.import.json('business_types (1).json')

Refer this file to check indented format of the given file.

JSON Format:

{
    "B2B": [
        {
            "q04ijnd6wjkcgg1cnyq04ijnd0kj42py": [
                "mumbai",
                "lucknow",
                "delhi"
             ]
         }
     ],
    "B2C": [
        {
            "q04ijnd6wjkcgg1cnyq04ijnd0kj42py": [
                "mumbai",
                "lucknow",
                "delhi"
             ]
         }
     ]
}

Output Expected

enter image description here

1 Answers

The function apoc.import.json does not allow that filename. After downloading the file locally, change it to business_types.json then try again.

CALL apoc.load.json("file:///business_types.json")
YIELD value
RETURN value;

See result below: enter image description here

Related