How does Dgraph import files other than RDF files, such as json or CSV?

How do I import a json file if I convert the CSV to json?I’m a newbie, I’m really sorry but maybe my question is a little bit simple。

1 Like

You can run a mutation to insert data from JSON format: https://docs.dgraph.io/mutations/#json-mutation-format

1 Like

emmm… I want to insert a local json document ? For example, a local document that contains several json data

just like load csv in cypher?
-H ‘X-Dgraph-MutationType: json’ -H ‘X-Dgraph-CommitNow: true’
This statement appears to read only one line of data, right?What I want to do is read in a local file?

I think if you can add a feature which is importing a local file like.json or .CSV file.Or a plug-in which turning them into RDF/ n-quad files will make it much easier for beginners to learn.

If you want to read a local file with cURL that contains a mutation you can do so by passing the filename prefixed with an @-sign. This is a feature of cURL that treats files as input. e.g.,

curl -H 'X-Dgraph-MutationType: json' -H 'Dgraph-CommitNow: true' localhost:8080/mutate -d @mutationFile.json