I want to upsert the content of a json string by the key “myID”, can this be done without having to modify the JSON the set the UID() calls in front of each attribute.

Just mutating with the content of a json is working fine.

func (s *Service) UpsertJSONFilter(jsonData []byte, key string) (*api.Response, error) {
	upsertQuery := fmt.Sprintf(`{
		q(func: eq(myID, %s)) {
			v as uid
	}`, key)

	upsertMutation := fmt.Sprintf(`{
		set {
	}`, string(jsonData))

	mu := &api.Mutation{
		SetNquads: []byte(fmt.Sprintf(`%s %s`, upsertQuery, upsertMutation)),
		CommitNow: true,

	response, err := s.DClient.NewTxn().Mutate(context.Background(), mu)
	if err != nil {
		return nil, err

	return response, nil