cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Illegal characters in APOC / loading json file

zepef
Node Link

Hello,

I am trying to import à json file with :

CALL apoc.load.json("file:///A novel knowledge graph development for industry design A case study on indirect coal liquefaction process.json")
YIELD value
RETURN value;

I can read from local file (apoc.conf created) but I get :

Failed to invoke procedure apoc.load.json: Caused by: java.nio.file.InvalidPathException: Illegal char <:> at index 4: file:///A novel knowledge graph development for industry design A case study on indirect coal liquefaction process.json

my APOC version is "4.4.0.1" and my json file is UTF-8 encoded
it is perfectly red by vscode and json viewer

Am I missing something ?

Thank you for any clue you could provide.

All the best,
PEF

1 ACCEPTED SOLUTION

@zepef

the original error was more than likely because the file name had spaces in the name and your apoc reference needs to url encode rhe spaces to %20

View solution in original post

4 REPLIES 4

@zepef

is the issue with the content of the file or the name of the file.

if you copy/rename the file to test.json and then try CALL apoc.load.json("file:///test.json" ...... are you able to read the file. If you are then this would suggest its not the content in the file rather an issue with name, and if thats the case maybe the name needs to be url encoded and thus try

CALL apoc.load.json("file:///A%20novel%20knowledge%20graph%20development%20for%20industry%20design%20A%20case%20study%20on%20indirect%20coal%20liquefaction%20process.json" .....

Dana,

It seems to work fine with absolute path

now I just have to build my graph from it

Best regards,

Pierre-Emmanuel

zepef
Node Link

Hello Dana,

Thank you so much for trying to help. I just followed your recommendation by renaming my file. Now I get something else.

my directory is right

3X_5_d_5d76b21c18a1c36619a7c0fd729bab40e49f2e40.png

my apoc conf file looks right

but I get

I will now try with an absolute path with use_neo4j_config=false, I will keep you updated.

Thanks again,

And Happy New Year !!!

Pierre-Emmanuel

@zepef

the original error was more than likely because the file name had spaces in the name and your apoc reference needs to url encode rhe spaces to %20