Hello
I have a json file on this path: C:\Users\Joao\Desktop\ProjetoFinal8150133\DadosExtraidos\new.json
When i try to invoque: call apoc.load.json("file:///C:\Users\Joao\Desktop\ProjetoFinal8150133\DadosExtraidos\new.json")
in Neo4j, it says:
"invalid input 's':expected four hexadecimal digits specifying a unicode character(line 1, column 34(offset: 33))
I had the same error, so I tried to change all \ in the path to / - and that worked, but I got an another error instead:
"Failed to invoke procedure apoc.load.jsonArray: Caused by: java.lang.RuntimeException: Import from files not enabled, please set apoc.import.file.enabled=true in your apoc.conf"
In the documents (https://neo4j.com/docs/labs/apoc/current/config/) I found a bunch of parameters that can be set in apoc.conf, but I didn't have that file so I just tried to create it with that parameter set to true. After a complete restart it worked.
(Now I have another error, but I think it's related to the json structure)
I hope this helps you
The invoke procedure error was my first error, i had to go to Manage on my DB, Settings, and at the end of the file i add apoc.import.file.enabled=true, and the error has gone, cause i don't even know where the apoc.conf is located.
Where's your apoc.conf file?
It should be located in the same folder as neo4j.conf, i.e c:/****/conf/apoc.conf
But since every database has it's own configuration, you have to copy the file (or create) to all databases that need that functionality.
Easiest are probably to do what I did, I copied it to all the folders containing neo4j.conf that I could find.
I think that if you manage neo4j.conf from within the program, you only manage that particular database. So you need to manage each database that you need this functionality on.
I actually created a file with only one row , apoc.import.file.enabled=true , and named it apoc.conf
Then I put it manually into the configuration folders.
For me the paths look like:
I just need to load my json file in one database friend
I'll try to create apoc.conf file in db folder, but i think that i don't find the database folder since i've already tried it once and nothing found, but let me check
Please keep the file in import folder. By default file need to to placed in the import forlder of respective DB else you need to change the configuration file. Please visit https://neo4j.com/docs/labs/apoc/current/import/load-json/ for reference
You don't need '///C:' in the path
Just have 'file:/users' in the beginning of the path.
If you, like me, get another error of something like "cannot read the url or file"
you have to put one more line in apoc.conf
apoc.import.file.use_neo4j_config=false
That is to allow file import from anywhere on the computer
Done. The solution was to put the file in the import folder and then use: call apoc.load.json("file:/new.json")
Thank you both for your suggestions!
Have a nice day and stay safe!