Import json file to neo4j

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))

What is wrong?
Thank you all and stay safe

Hello

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

/Chris

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?

Oh ok, in the url you've sent me there's the guide, sorry friend

Hello Chris. I don't seem to find the location of apoc.conf. Can u help me please?

Hi Costa

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 got the neo4j.conf in the neo4j desktop in "Manage -> Settings" of the database, is that the same?

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:

C:\Users\chris.Neo4jDesktop\neo4jDatabases\database-3369b9ac-cf14-4823-8145-217097145299\installation-4.0.3\conf\apoc.conf

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


This is what i get after creating the file just like you(i've found the folder) and doing all you recomend

Hi @costa0096,

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

Hi

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

I've done that to, but that don't solve my problem friend

Ok friend,i'll try that and then i'll say something. Thanks :)

@costa0096

What happened when you keep the file in the import folder?

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!