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

mutation

#1

Hi!

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


(Daniel Mai) #2

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


#3

Thank you :slight_smile: