Additional explanation in documentation for json curl mutation useful to avoid errors


I’ve tried to load json data in dgraph via curl and I’ve got the following error message:

{“errors”:[{“code”:“ErrorInvalidRequest”,“message”:“json: cannot unmarshal array into Go value of type map[string]*alpha.skipJSONUnmarshal”}]}

I found out that this is because the json file needs to contain also the mutation statement.

Please add to the description here under “Mutation with a JSON file:” that the json file should contain the mutation command. For example adding

{ “set” :

at the beginning and

at the end of the file. This can be done using bash (especially useful when handling with huge json files):

sed -i ‘1i { “set”:’ filename.json
cat ‘}’ >> filename.json

Thanks for the suggestion, @graphpivot. That docs section has been updated with more details about the JSON file format for mutations using curl.

Thank you :slight_smile: