Search code examples
memgraphdb

I am trying to run json_util.load_from_path but I get FileNotFoundError


I'm having problems with json_util.load_from_path procedure.

I tried to to pass an absolute path with a "file:///" prefix but I get the error FileNotFoundError when executing the function in my application.

My code looks something like this

CALL json_util.load_from_path("file:///home/mel/data/data.json") 
YIELD objects
UNWIND objects AS o
RETURN o.first_name AS name, o.last_name AS surname;

If it matters I'm using Memgraph docker image (pure one, not the Platform).


Solution

  • If you’re running Memgraph with Docker, JSON file has to be located in the Docker container. Ideally, you would copy your file to /usr/lib/memgraph with docker cp file.json <container_id>:/usr/lib/memgraph/file.json Then you would have CALL json_util.load_from_path("/usr/lib/memgraph/file.json") as a part of your query.