Illegal characters in APOC / loading json file

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

@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" .....

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

ScreenCap - Import Dir 02

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

Dana,

It seems to work fine with absolute path

now I just have to build my graph from it :grinning:

Best regards,

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

1 Like